【问题标题】:Unresolved external symbols in Visual Studio 2010Visual Studio 2010 中未解析的外部符号
【发布时间】:2012-12-29 12:31:29
【问题描述】:

我来自 Xcode,试图在 Visual Studio 2010 中编译一个项目,我收到以下错误:

2>ofxCLeye.obj : error LNK2019: unresolved external symbol "struct _GUID __cdecl CLEyeGetCameraUUID(int)" (?CLEyeGetCameraUUID@@YA?AU_GUID@@H@Z) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices@ofxCLeye@@SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "int __cdecl CLEyeGetCameraCount(void)" (?CLEyeGetCameraCount@@YAHXZ) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices@ofxCLeye@@SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrameDimensions(void *,int &,int &)" (?CLEyeCameraGetFrameDimensions@@YA_NPAXAAH1@Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame@ofxCLeye@@QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrame(void *,unsigned char *,int)" (?CLEyeCameraGetFrame@@YA_NPAXPAEH@Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame@ofxCLeye@@QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeDestroyCamera(void *)" (?CLEyeDestroyCamera@@YA_NPAX@Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close@ofxCLeye@@UAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraStop(void *)" (?CLEyeCameraStop@@YA_NPAX@Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close@ofxCLeye@@UAEXXZ)
... etc etc...
2>bin\clEye_debug.exe : fatal error LNK1120: 10 unresolved externals

我想编译器正在尝试链接 CLEyeMulticam.lib 但没有找到它。我认为我已经正确配置了它。

您能否指出在 VS2010 中包含库所需的步骤?

谢谢,

马克

【问题讨论】:

  • CLEyeMulticam.lib 是你一直存在的文件还是应该由 VS2010 构建的?

标签: c++ visual-studio-2010 openframeworks


【解决方案1】:

抱歉,如果这过于迂腐。如果这是一个预构建的库(不是作为项目/解决方案的一部分构建的),那么请确保您

a) #include the correct header
b) #define any requisite macros
c) speciy additional .lib dependencies as shown below. 

除非库文件位于 LIB 环境变量中,否则您需要指定完全限定的路径 (d:\src\project\libs\camera.lib)。

【讨论】:

  • +1:但如果将 libs 目录添加到 Additional Include Directories、使用属性表添加路径、使用环境变量添加路径或使用相对路径,则路径不需要完全限定你的项目目录。
  • 正是我所做的,但我仍然收到错误消息。肯定有其他问题。还是谢谢
  • Marc,库是导出 C 还是 C++ 接口?如果您尝试将“C”库(我猜是 API 名称中的情况)与 C++ 代码链接,则名称修改会导致链接错误。在库头文件中检查所有库函数是否包含在 extern "C" { } 块中。
【解决方案2】:

在项目的属性页中,导航到配置 > 链接器 > 输入并将 lib 文件添加到附加依赖项设置。这适用于 VC++ 2008,可能同样适用于 2010。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-28
    • 2016-08-08
    • 1970-01-01
    • 1970-01-01
    • 2015-06-15
    • 2023-03-22
    • 2015-10-30
    相关资源
    最近更新 更多