eclipse cdt中未解析的外部符号

时间:2011-07-10 15:20:14

标签: c++ eclipse linker eclipse-cdt

我尝试使用eclipse cdt构建cpp文件。链接器抛出“未解析的外部符号”,但是包含函数实现的lib文件的路径列在Project properties->C/C++ Build->Environment上的LIB环境变量中

我做错了什么?

UPD 我尝试构建file。路径RpcRT4.Lib

上有lib C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\

链接器失败:

**** Build of configuration Debug for project test cpp ****

**** Internal Builder is used for build               ****
link /debug /nologo /OUT:test cpp.exe main.obj
main.obj : error LNK2019: unresolved external symbol __imp__RpcStringFreeA@4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)"(?Initialize_CreateWindowClass@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__UuidToStringA@8 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__UuidCreate@4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol __imp__UnregisterClassA@8 referenced in function "void __cdecl DeInitialize_DestroyWindowClass(void)" (?DeInitialize_DestroyWindowClass@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "bool __cdecl Initialize_CreateMainWindow(void)" (?Initialize_CreateMainWindow@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "void __cdecl DeInitialize_DestroyMainWindow(void)" (?DeInitialize_DestroyMainWindow@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__PostMessageA@16 referenced in function "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
main.obj : error LNK2019: unresolved external symbol __imp__SendMessageA@16 referenced in function "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
main.obj : error LNK2019: unresolved external symbol __imp__RegisterWindowMessageA@4 referenced in function _main
test cpp.exe : fatal error LNK1120: 15 unresolved externals
Build error occurred, build is stopped
Time consumed: 2438  ms.  

项目的环境设置 settings http://img830.imageshack.us/img830/847/eclipsecdtlib.png

1 个答案:

答案 0 :(得分:1)

我不清楚你是否已经基于这个问题做了这个,但只是将目录添加到链接器的搜索路径对于我曾经使用的任何编译器/链接器来说都是不够的。那里可能有数百个不同的库,甚至同一个库的不同版本,链接器也不知道你做了什么和不想做什么。您需要明确地告诉它使用适当的参数链接库。

看起来您正在使用我从未使用过的Microsoft链接器,所以我无法帮助您使用特定的标志,但是如果这是问题,应该很容易找到它在文档中的内容。我认为Eclipse有一种在GUI中指定它的方法,它应该在它支持的各种编译器中是通用的。