0

I'm using C++ and visual studio 2015. I've created 2 projects in 1 solution. The first project is a static library and the other a DLL. I want to include one header file from the static library to use it in the DLL. I tried specifying the path to the header file with - Project->Properties->C/C++ -> General -> Additional include directories but it doesn't work. When I try to include the header file I get a red underline saying "cannot open source file "SomeHeaderFile.h".

Thanks for the help.

G. Penev
  • 1
  • 4
  • This should work. Do you get a compiler error? – drescherjm Jul 26 '16 at 16:43
  • Make sure to edit the DLL project (using the method you mentioned), and also make sure that the path that you enter there is the correct path to the header file (its parent dir). If both of these requirements are fulfilled, it should compile. Probably you'll have to do the same for the linker. Check [this answer](http://stackoverflow.com/questions/32156336/how-to-include-openssl-in-visual-studio-expres-2012-windows-7-x64/32158521#32158521) for details (it refers to _OpenSSL_, but the principle is the same). – CristiFati Jul 26 '16 at 16:47
  • On the project properties dialog, make sure you are modifying the include directories on the proper build configuration. If you edit the Release configuration, but build with the Debug configuration, it could have the behavior you're describing. – C. Korb Jul 26 '16 at 16:48

1 Answers1

0

Thanks for the tips but I found out how to make it work. The DLL is in a extra folder. All I had to do was #include "../../TheHeaderFileThatISpentHoursTryingToGet.h". I deleted the reference in the additional include directories path and it still works. I always thought that it made sense for files from different projects in the same solution to be accessible throughout all the projects. Thanks again.

G. Penev
  • 1
  • 4