Visual Studio 2013 中尝试引用静态库项目时出现链接器错误
Linker error when trying to reference static library project in Visual Studio 2013
我的 Visual Studio 解决方案中有两个项目:A(静态库 .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:\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
我自己找到了答案,当然是在所有回复者的帮助下。实际上,项目 A(.lib 项目)的所有头文件和实现都在我在项目 B 中引用的同一文件夹中。因此,当所有实现都可用时,我不必 link 我在项目 B 中的项目 A 的 .dll 输出,但不得不引用它。
另一个问题是我没有link编辑(在项目 B 中)构建项目 A 所需的库。现在,它已经启动并且 运行...
我的 Visual Studio 解决方案中有两个项目:A(静态库 .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:\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
我自己找到了答案,当然是在所有回复者的帮助下。实际上,项目 A(.lib 项目)的所有头文件和实现都在我在项目 B 中引用的同一文件夹中。因此,当所有实现都可用时,我不必 link 我在项目 B 中的项目 A 的 .dll 输出,但不得不引用它。
另一个问题是我没有link编辑(在项目 B 中)构建项目 A 所需的库。现在,它已经启动并且 运行...