您好我使用SDL2与MINGW制作一个简单的窗口并且无法编译,代码如下,结果如下:
#include <iostream>
#include "SDL/SDL.h"
using namespace std
int main(int argc, char* args[])
{
SDL_Window *win = SDL_CreateWindow("WINDOW TEST", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);
main_t:
// this is the loop
goto main_t;
return 0;
}
构建错误:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../.. ../libSDL2main.a(SDL_windows_main.o): In function `main_getcmdline': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:142: undefined reference to `SDL_wcslen' /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:142: undefined reference to `SDL_iconv_string' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `ParseCommandLine': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:54: undefined reference to `SDL_isspace' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `main_getcmdline': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:153: undefined reference to `SDL_malloc' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `ParseCommandLine': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:54: undefined reference to `SDL_isspace' /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:80: undefined reference to `SDL_isspace' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `main_utf8': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:123: undefined reference to `SDL_SetMainReady' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `main_getcmdline': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:161: undefined reference to `SDL_free' /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:162: undefined reference to `SDL_free' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `ParseCommandLine': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:80: undefined reference to `SDL_isspace' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `OutOfMemory': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:107: undefined reference to `SDL_ShowSimpleMessageBox' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `console_wmain': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:181: undefined reference to `SDL_malloc' /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:185: undefined reference to `SDL_wcslen' /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:185: undefined reference to `SDL_iconv_string' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `main_utf8': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:123: undefined reference to `SDL_SetMainReady' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libSDL2main.a(SDL_windows_main.o): In function `console_wmain': /Users/slouken/release/SDL/SDL2-2.0.5-source/foo-x86/../src/main/windows/SDL_windows_main.c:192: undefined reference to `SDL_free' collect2.exe: error: ld returned 1 exit status