无法编译SDL版本

时间:2014-08-09 10:54:16

标签: c++ visual-studio-2012 sdl sdl-2

尽管我可以编译调试版本,我无法编译发布版本。我的链接设置很好,但我收到了这些奇怪的错误。

Error   1   error LNK2001: unresolved external symbol _Main.cpp C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\LINK  ForgedMemories
Error   2   error LNK2001: unresolved external symbol _SDL_GetTicks C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\BattleManager.obj ForgedMemories
Error   3   error LNK2001: unresolved external symbol _SDL_Init C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   4   error LNK2001: unresolved external symbol _Mix_PlayChannelTimed C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   5   error LNK2001: unresolved external symbol _SDL_RWFromFile   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   6   error LNK2001: unresolved external symbol _Mix_LoadWAV_RW   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   7   error LNK2001: unresolved external symbol _Mix_Quit C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   8   error LNK2001: unresolved external symbol _Mix_FreeChunk    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   9   error LNK2001: unresolved external symbol _SDL_GetError C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   10  error LNK2001: unresolved external symbol _Mix_OpenAudio    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Sound.obj ForgedMemories
Error   11  error LNK2001: unresolved external symbol _SDL_GetMouseState    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\EventManager.obj  ForgedMemories
Error   12  error LNK2001: unresolved external symbol _TTF_RenderText_Shaded    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   13  error LNK2001: unresolved external symbol _SDL_RenderCopy   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   14  error LNK2001: unresolved external symbol _SDL_CreateTextureFromSurface C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   15  error LNK2001: unresolved external symbol _TTF_RenderText_Blended   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   16  error LNK2001: unresolved external symbol _TTF_OpenFont C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   17  error LNK2001: unresolved external symbol _TTF_CloseFont    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   18  error LNK2001: unresolved external symbol _TTF_Init C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   19  error LNK2001: unresolved external symbol _SDL_QueryTexture C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   20  error LNK2001: unresolved external symbol _SDL_FreeSurface  C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Font_Setup.obj    ForgedMemories
Error   21  error LNK2001: unresolved external symbol _SDL_GetKeyboardState C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Keyboard.obj  ForgedMemories
Error   22  error LNK2001: unresolved external symbol _SDL_PumpEvents   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Keyboard.obj  ForgedMemories
Error   23  error LNK2001: unresolved external symbol _SDL_DestroyWindow    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   24  error LNK2001: unresolved external symbol _SDL_CreateWindow C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   25  error LNK2001: unresolved external symbol _SDL_PollEvent    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   26  error LNK2001: unresolved external symbol _SDL_DestroyRenderer  C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   27  error LNK2001: unresolved external symbol _SDL_RenderPresent    C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   28  error LNK2001: unresolved external symbol _SDL_RenderClear  C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   29  error LNK2001: unresolved external symbol _SDL_CreateRenderer   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\SDL_Setup.obj ForgedMemories
Error   30  error LNK2001: unresolved external symbol _SDL_DestroyTexture   C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\Sprite.obj    ForgedMemories
Error   31  error LNK2001: unresolved external symbol _IMG_LoadTexture  C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\ForgedMemoriesV2.3\Sprite.obj    ForgedMemories
Error   32  error LNK1120: 31 unresolved externals  C:\Users\Ryan\Documents\Visual Studio 2012\Projects\C++\ForgedMemories\Release\ForgedMemories.exe   ForgedMemories

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

这很可能是因为没有为两种配置设置库输入,这是一个常见的错误。您只需要将所需的库添加到Release配置中。这也适用于头文件包含目录

enter image description here