Creating a static library Visual Studio

拟墨画扇 提交于 2020-01-06 05:40:07

问题


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 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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4830844/creating-a-static-library-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!