C++ Visual Studio 2010 中未解析的外部符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5757037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 18:48:56  来源:igfitidea点击:

Unresolved external symbols in Visual Studio 2010

c++visual-studio-2010openframeworks

提问by Marc

I am coming from Xcode, trying to compile a project in Visual Studio 2010, and I get the following errors:

我来自 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

I imagine that the compiler is trying to link CLEyeMulticam.libbut not finding it. I think that I have configured it properly.

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

Could you point me with the needed steps to include a library in VS2010 ?

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

Thank you,

谢谢,

marc

马克

回答by J Evans

Apologies if this is overly pedantic. If this is a pre-built library (not built as part of the project/solution) then make sure you

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

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

enter image description here

在此处输入图片说明

You will need to specify a fully qualifed path (d:\src\project\libs\camera.lib) unless the libary file is in the LIB environment variable.

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

回答by Frederik Slijkerman

In the Property Pages for your project, navigate to Configuration > Linker > Input and add the lib file to the Additional Dependencies setting. This applies to VC++ 2008, probably likewise to 2010.

在项目的属性页中,导航到 Configuration > Linker > Input 并将 lib 文件添加到 Additional Dependencies 设置。这适用于 VC++ 2008,可能同样适用于 2010。