尝试引用Visual Studio 2013中的静态库项目时发生链接器错误
Linker error when trying to reference static library project in Visual Studio 2013
我的Visual Studio解决方案中有两个项目:A(static library.lib项目)和B(使用A的项目)。我通过以下步骤引用了B中的A:
right click B > properties > common properties > references > add new reference > select A from projects tab
我已经使用properties > Configuration Properties > C/C++ > General
中的additional include directories
选项设置了.h文件的路径
项目A在单独构建时成功构建。但在构建项目B时,它显示unresolved external symbol
错误如下:
Error 46 error LNK2001: unresolved external symbol __imp____glewActiveTexture c:Usersstudentdocumentsvisual studio 2013ProjectsMCAProjectNarovatarNarovatarOGLDEV_Imported.lib(ogldev_texture.obj) Narovatar
Error 21 error LNK2001: unresolved external symbol __imp____glewAttachShader c:Usersstudentdocumentsvisual studio 2013ProjectsMCAProjectNarovatarNarovatarOGLDEV_Imported.lib(technique.obj) Narovatar
Error 12 error LNK2001: unresolved external symbol __imp____glewBindBuffer c:Usersstudentdocumentsvisual studio 2013ProjectsMCAProjectNarovatarNarovatarogl_mesh.obj Narovatar
Error 13 error LNK2001: unresolved external symbol __imp____glewBufferData c:Usersstudentdocumentsvisual studio 2013ProjectsMCAProjectNarovatarNarovatarogl_mesh.obj Narovatar
我还能剩下什么?有什么想法吗?
右键单击properties -> linker -> general ->additional library directories-> browse for your lib file directory
。
右键单击"properties -> linker -> general ->input-> write your lib file name
"。
不要忘记让它们两者MT或二者MD,如下所示:
properties -> C/C++ -> Code generation -> Runtime-library-> change them both to be the same
我自己找到了答案,当然是在所有回应者的帮助下。事实上,项目A(.lib项目)的所有头文件和实现都在我在项目B中引用的同一个文件夹中。因此,当所有实现都可用时,我不必将项目A的.dll输出链接到项目B中,只需引用它即可。
另一个问题是,我没有(在项目B中)链接构建项目A所需的库。现在,它已经启动并运行。。。
- CMake 项目链接静态库
- 尝试使用 gradle 构建指向静态库的 c++ 项目链接时找不到头文件
- 将错误GoogleMock与我在linux下的C++项目链接
- 将OpenBLAS与Qt Creator项目链接
- 从大型 github 项目链接共享库
- 将TBB库与QTCreator与CMAKE项目链接
- 如何与Libm.so和libdl.so与我的Bazel项目链接
- 将C++项目与 Visual Studio 中的窗体项目链接
- GTEST测试项目链接链接到其他可执行文件
- Visual Studio,将项目链接在一起并进行测试
- 如何在Xcode4上从头开始构建C++项目-链接现有和新的外部库
- 我怎么能说视觉工作室将库与我的项目链接起来
- 添加类后项目链接错误
- CMake:从外部项目链接共享C++对象会生成具有相对路径的二进制文件,而不是绝对路径
- Netbeans/C++:将2个项目链接在一起(可执行文件/动态库)
- 裸机目标与cmake项目链接错误
- 使用lua lib的Xcode c++项目链接错误
- 试图从另一个项目链接类时出现链接器错误
- 如何将code::块设置为在目标链接器选项之前链接项目链接器选项
- 无法将一个项目的头和 CPP 文件与另一个项目链接 LNK2019:未解决的外部符号错误