OpenGL Control within main Visual Studio project

Hello, here’s what I’m trying to do. I want a reusable custom control that draws with OpenGL that I can layout with the Windows Forms Designer in Visual Studio. I want it compiled in the main project rather than in an external dll.

The Windows Form Designer can only handle 32-bit, so I’m compiling with the /clr:safe and clr/imagetype:safe options, which is apparently equivalent to the AnyCPU setting. This is fine up until I add openGL32.lib to the linker’s additional dependencies, at which point I get following compile errors:

Warning 1 warning LNK4075: ignoring ‘/INCREMENTAL’ due to ‘/CLRIMAGETYPE’ specification c:…\Projects\CustomControlTest\CustomControlTest\LINK CustomControlTest
Error 2 error LNK1181: cannot open input file ‘openGL32.h’ c:…\Projects\CustomControlTest\CustomControlTest\LINK CustomControlTest

Any thoughts? Ta!

You should look at SharpGL

Is this C/C++ or C#? If the former, is it managed C++ or native code?

Either way, it’s important that you resolve these difficulties before you even think about alternative libraries, because you’ll likely have similar difficulties with those too.

Neither of these are compile errors, they come from the linker (hence the “LNK” prefix on the number) and the first one isn’t even an error - it’s just a warning telling you that it’s ignoring one link option that’s not compatible with others. The link option being ignored - using incremental linking - is not sufficiently important to worry about for now, so it’s OK to park it until later (if you’re happier to be rid of it just unselect incremental linking under your project properties).

The second is telling you that it can’t find an input file and the most likely reason is that you don’t have your include directories set up correctly for your project. So double-check those and also check lib directories, because if you’ve missed include directories it’s likely you’ve also missed lib directories.

Yep, with C++. I’m trying to create a managed control class, but with unmanaged members which I’m also using in a OS X version.

Turns out I had a typo in the dependencies. Rookie error! I’ve got other problems now, but I reckon they’re unrelated to OpenGL.

Many thanks!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.