简体   繁体   English

未解决的外部符号,即使我认为我正确链接(MSVC)

[英]unresolved external symbol even though i think i am linking correctly (MSVC)

i have a project that is using SDL as an external library. 我有一个使用SDL作为外部库的项目。 The project uses functions such as _SDL_WM_SetCaption, _SDL_FillRect or _SDL_MapRGBA. 该项目使用_SDL_WM_SetCaption,_SDL_FillRect或_SDL_MapRGBA等函数。 I have told the linker to include the two libraries SDL.lib and SDLmain.lib and have told it to look in the folder where these libraries are placed. 我已告诉链接器包含两个库SDL.lib和SDLmain.lib并告诉它查看放置这些库的文件夹。 I have also inspected the library files with dumpbin.exe and the functions are there. 我还用dumpbin.exe检查了库文件,函数就在那里。 however, it still doesnt work compiling/linking? 但它仍然无法编译/链接? why? 为什么? anyone have any ideas? 有人有想法么?

edit: here is an example output of the linker/compiler error: 编辑:这是链接器/编译器错误的示例输出:



14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function "public: void __thiscall SDLGLEngine::SetTitle(char *)" (?SetTitle@SDLGLEngine@@QAEXPAD@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_FillRect referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_MapRGBA referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_GL_SetAttribute referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_Quit referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)
14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_Init referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z)

Possible reasons: 可能的原因:

  • the sdl.lib and sdlmain.lib settings are not added to dependency list sdl.lib和sdlmain.lib设置未添加到依赖项列表中
  • their location was not added to the list of directories where the linker looks 它们的位置未添加到链接器所在的目录列表中
  • you have mismatched 32 and 64 bit versions of the libraries. 你有不匹配的32和64位版本的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使定义了未解析的外部符号? - Unresolved External Symbol, even though it is defined? 我如何获得链接器错误:无法解析的外部符号 - How am I getting a linker error: Unresolved external symbol 为什么我收到“未解析的外部符号”消息? - Why am I getting an “unresolved external symbol” message? 我该如何解决MSVC 2005错误:无法解析的外部符号__environ - how can I fix the MSVC 2005 error: unresolved external symbol __environ 即使函数存在char *,仍然存在未解析的外部符号错误 - unresolved external symbol error even though the function exists char* 将静态库链接到MSVC中的共享库会导致无法解析的符号 - Linking a static library to a shared library in MSVC causes unresolved symbol 我正在学校的一个小班级模板实验室中工作,我的代码无法编译,这给了我一个无法解析的外部符号 - I am working on a small class template lab for school and my code will not compile, it gives me an unresolved external symbol 错误 LNK2019:未解析的外部符号 - 我做错了什么? - error LNK2019: unresolved external symbol - what am I doing wrong? 出现typedef时,为什么会出现未解决的外部符号错误? - Why am I getting an Unresolved External Symbol error while the typedef is present? C ++链接错误未解决的外部符号 - C++ linking error unresolved external symbol
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM