我正在使用 Microsoft Visual Studio C++ 2010 Express Edition,并且正在尝试使用 SDL_ttf.lib 编译 SDL 项目并收到以下错误消息:
1>SDL.obj : error LNK2019: unresolved external symbol _TTF_CloseFont referenced in function "void __cdecl DrawTextW(struct SDL_Surface *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int)" (?DrawTextW@@YAXPAUSDL_Surface@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHH@Z)
1>SDL.obj : error LNK2019: unresolved external symbol _TTF_RenderText_Shaded referenced in function "void __cdecl DrawTextW(struct SDL_Surface *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int)" (?DrawTextW@@YAXPAUSDL_Surface@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHH@Z)
1>SDL.obj : error LNK2019: unresolved external symbol _TTF_OpenFont referenced in function "void __cdecl DrawTextW(struct SDL_Surface *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int)" (?DrawTextW@@YAXPAUSDL_Surface@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHH@Z)
1>SDL.obj : error LNK2019: unresolved external symbol _TTF_Init referenced in function "bool __cdecl Init(void)" (?Init@@YA_NXZ)
1>SDL.obj : error LNK2019: unresolved external symbol _TTF_Quit referenced in function _SDL_main
我已经搜索了解决方案,但没有找到任何可以解决我的问题的方法。我没有忘记链接 SDL_ttf.lib,我也将文件夹与它链接,包含标题并将 SDL_ttf.dll 放入我的项目文件夹中。
PS 我对 SDL_image 有同样的问题。