I am trying to create a static library in Visual Studio that contains other sources which paths are in Additional Include Directories defined.
I can build and create the library without problems, but when I try to use it开发者_Python百科 in another project, it seems that it does not include the sources which are defined in Additional Include Directories, so It does not find the sources specified in that paths. Does the static library not include that sources when it is build? Is there another way to include that sources when you try to create a static library?
Thanks in advance
Having additional include directories defined in the static library will not cause dependent projects to also include those directories.
In the end, the static library output is the .lib file containing object code ready to be linked.
The solution is to also add the path to any dependant project's additional include directory path if you need it to resolve #inludes.
If I am reading this correctly, you have...
Project A (compiled to ProjectA.lib)
Additional Include Directories: (SomePath)\Include
Project B
Libraries: ProjectA.lib
You will need to add the include directories used by Project A into Project B as well so it can find the method definitions at compile time.
精彩评论