Question

For the last two years I have been using Java and NetBeans, where all I need to do to add a new third party library to my project is throw in the .jar file and NetBeans does the rest.

Recently I have switch to C++ and Visual Studio and I am having a really hard time getting a project to compile using OpenGL, GLUT and GLEW due to 'Missing reference' errors.

Some tutorials tell me I need to download the projects for GLUT/GLEW and run them (that didn't work), some tutorials tell me I need to add a .dll file to my Win32 folder, others say just put the header files in the same directory as your project and some say I need to install these libraries in to Visual Studio itself, not just to my project.

None of these approaches have worked thus far.

All I want is for this one project to use these libraries. This is throwing a major spanner in the works for me at the moment, any help would be appreciated.

Was it helpful?

Solution

Sorry, I don't have an easy answer for you. I've been using OpenGL on Windows for years, and it can be a pain.

MS doesn't even (really) support OpenGL, the headers that come with Windows are the old 1.x ones - and they have no plans on changing that (they want to you use DX).

So, I would start small.

First, get a basically empty Win32 console "Hello World" app running.

Then, just add one component, like Glut.

Then, do the same - keeping it compiling / linking - incrementally add other components.

Wherever they tell you to put headers, libraries, DLLs, etc, it needs to be reflected in your project file. So:

  • add the location of the header files to "C/C++->Additional Include Directories"
  • add the .lib files to the "Linker->Input->Additional Dependencies"
  • (it still won't find them so) add the location of the .lib files to "Linker->General->Additional Library Directories"

With all that in place it should compile and link, but may not run still because it can't find the DLLs (that go along with the .lib files).

The shortest path to getting running might just be to dump the DLLs in the Windows/System32 folder. But in the long run that can be problematic as other apps may overwrite it (or see you as overwriting theirs).

What I do with specific DLLs is just load them explicitly in my application so I know for sure what DLL I'm getting (I don't do much Windows-specific GL, but when I did, I had my own \OpenGL directory with the versions of .h files, libs and DLLs I wanted).

Good Luck!

Oh, LoadLibrary() will load a DLL, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top