title: Visual C++ .NET using C# library. Need help?
body: <p>I have a library a friend wrote in C# and I need to use it in C++.NET. I'm new to VC++.NET and I don't know how to declare my class so it can be used by all functions in my file.. Here's my code..</p>
  
  <pre><code>using namespace System;
  using namespace ONEAPI;
  namespace Bot{
  
      void InitializeBot();
      ONEAPI::Connection connection(true);
      int main(array&lt;System::String ^&gt; ^args)
      {
          Console::BackgroundColor = ConsoleColor::Black;
          InitializeBot();
          return 0;
      }
      void InitializeBot(){
          connection.StartConnection("127.0.0.1", 1274, "username",
              "B73955EE7A30E959819BAE2392F6F4441DF98C66A4026EF55287A81D1F815504",
              "R0Bo");
      }
  }
  </code></pre>
  
  <p>I get this error: </p>
  
  <blockquote>
    <p>Error  1  error C3145: 'connection' : global or static variable may not have managed type 'ONEAPI::Connection'  Visual Studio 2010\Projects\1hubBot\1hubBot\1hubBot.cpp  10  1  1hubBot</p>
  </blockquote>