I have been in this situation quite a few times where visual studio does not honor the Additional Include Directories when it comes to lib
and header source files
. For example, I just downloaded MyGUI source code and made sure the include directories were correct. I even put them to absolute paths, Visual Studio still complained that it could not find specific header files.
Does anybody experience the same thing with projects, and if so, is there a solution to this problem?Blockquote
EDIT: My apologies for not being able to explain fully. I know that the library and source files have different include directories. The project that I received had correct directory paths for the Additional Include Directories and Additional Library Directories but Visual Studio still failed to recognize them properly. I can right click and open the header file within Visual Studio but when compiling it still complains it cannot find the required header files. I regularly make projects relying on a framework I myself programmed, so I am quite familiar with how to set up dependencies. This is however the second time this seems to be happening. I don't recall which 3rd party project I was trying to compile last time, but Visual Studio simply refused to believe that the
Additional Include Directories
paths is where it should look for the header files. I am not sure how to give the complete details of this particular library (MyGUI) but I can point you to the website where you can download it to try and see if it is able to find the header files that are included in the project (if it doesn't compile, that is fine, and it is probably because of additional dependencies, but it should at least be able to find files in the common folder, especially when I put absolute paths in Additional Include Directories)
If by lib files you mean library (.lib) files, the directory location is not specified through C/C++/General/Additional Include Directories but rather through Linker/General/Additional Library Directories.
It's logical if you think about it. C/C++ options are all compilation options, settings involved with compiling .cpp and .h files. Linker options are all linking options, settings involved with linking up .obj and .lib files.
I have the same problem : Can't find
.lib
file even though I've added the additional include directory.From an answer of Additional include directory in Visual studio 2015 doesn't work, I tried:
Then it works for me.
I had this issue too. Just like sam said - this string value containing path to your framework includes has to be the same for the Debug and Release configurations. So the best way is to choose "Configuration:All Configurations" and "Platform:All Platforms" from the two context checklists on the top of the project properties window before typing it in, or copying from windows explorer adress bar.
This happened to me once. It turned out the inconsistency of the Debug vs Release builds. When I modified one build, the other build was being compiled. Please set both builds with same include folders and see if it works. Good luck.
Can you elaborate on this? If I recall, there are at least two places in Visual Studio where you can configure this:
Tools/Options/Projects and Solutions/VC++ Directories
)Project/Properties/Configuration Properties/"C/C++"/General/Additional Include Directories
If you're adding the include directories per-project (#1), which I think you are, and then trying to include from another project, this will obviously not work. Try adding them at the per-installation level and see if it works.
Also, this may sound stupid/simplistic, but make sure the path is right (i.e. copy-paste into Explorer's path bar and see if the header files are in that folder).
I had the same symptoms in my c++ project. Navigating from header to header went fine, but after toggling to the source file of a header (let's say
foo.cpp
), then the navigation to an#include <bar.cpp>
in that source file failed. I got the following error:After research I noticed that the system build path given in the error where not extended with the include paths of the project. In other words: IntelliSense didn't know that the source file (
foo.cpp
) was part of the project, and therefore it didn't use the include paths of the project to search for the#include <bar.cpp>
.The fix for me was creating a file
intelliSense.cpp
(file name doesn't matter) that is part of the project, but excluded from the build. This file contains an include for each source file. ex:This way IntelliSense knows that these source files are part of the project, and will therefore use the include paths of the project to resolve the
#includes
in those source files.