我的Visual Studio解决方案中有两个项目:A(静态库.lib项目)和B(使用A的项目).我按照以下步骤在B中引用了A:
right click B > properties > common properties > references > add new reference > select A from projects tab
我已经使用additional include directories
选项设置了.h文件的路径properties > Configuration Properties > C/C++ > General
单独构建时,项目A成功构建.但是在构建项目B时,它显示unresolved external symbol
如下错误:
Error 46 error LNK2001: unresolved external symbol __imp____glewActiveTexture c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(ogldev_texture.obj) Narovatar Error 21 error LNK2001: unresolved external symbol __imp____glewAttachShader c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(technique.obj) Narovatar Error 12 error LNK2001: unresolved external symbol __imp____glewBindBuffer c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_mesh.obj Narovatar Error 13 error LNK2001: unresolved external symbol __imp____glewBufferData c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_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