1

I am building a DLL using visual studio, which involves installing the following libraries :

  • GLM
  • GLFW
  • GLEW

I linked those libraries to visual studio using the following method :

  • specifying Additional Include Directories in the project property page
  • specifying Additional Dependencies in the project property page
  • specifying Additional Library Directories in the project property page

Of course GLM is a header only Library, which means that I am only required to specify the Additional Include Directories for GLM. And my dll built perfectly fine.

But the real problem occurs when using the library in a test project. I linked my test project to my library using the method mentioned above, but when I tried to build the test project, it produces the following results :

Cannot open include file <GLFW/glfw3.h>

And the same goes for glew. It seems that these libraries are not found when the library is being used by another test project. How can I fix this? Any help would be highly appreciated.

Hung Truong
  • 191
  • 1
  • 10

1 Answers1

0

Set the Additional Include Directories correctly for all projects. The compiler doesn't magically inherit settings from a project which happens to have it's output linked into another project. So you have to provide it the correct include path for any source file it sees. To spare yourself from having hardcoded paths to include directories you could use a property sheet common for both projects. Or you could tackle the problem in code and make use of the PIMPL idiom (eventually as simple as e.g. forward declaring some GL types and using a unique_ptr to them in public classes) so the headers of your project never expose any of the external include files.

stijn
  • 31,563
  • 13
  • 95
  • 145