gpt4 book ai didi

c++ - eclipse cdt 中未解析的外部符号

转载 作者:行者123 更新时间:2023-11-28 08:18:58 24 4
gpt4 key购买 nike

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

的 LIB 环境变量中

我做错了什么?

UPD 我尝试构建 file .路径C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\

下有lib RpcRT4.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

最佳答案

我不完全清楚您是否已经根据问题完成了此操作,但仅将目录添加到链接器的搜索路径对于我使用过的任何编译器/链接器来说是不够的。那里可能有数百个不同的库,甚至是同一个库的不同版本,链接器不知道你想要哪些和不想要哪些。您需要明确地告诉它使用适当的参数链接库。

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

关于c++ - eclipse cdt 中未解析的外部符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6641912/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com