所以,我正在尝试使用MinGW在Eclipse中为C ++安装SDL2,但是我无法从the tutorial by Cave of Programming获得测试程序来构建。我已将教程所说的所有文件放到各自的位置。我正在使用SDL 2.0.5版。
Here是我的日食设置。
构建错误日志:
20:42:34 **** Incremental Build of configuration Debug for project sdl
**** Info: Internal Builder is used for build g++ "-IC:\\MinGW\\include\\SDL2" "-includeC:\\MinGW\\include\\SDL2\\SDL.h"
-O2 -g -Wall -c -fmessage-length=0 -o "src\\sdl.o" "..\\src\\sdl.cpp" g++ "-LC:\\MinGW\\lib" -shared -o libsdl.exe "src\\sdl.o" -lmingw32
-lSDL2main -lSDL2 src\sdl.o: In function `SDL_main': D:\c++\sdl\sdl\Debug/../src/sdl.cpp:7: undefined reference to `SDL_Init' D:\c++\sdl\sdl\Debug/../src/sdl.cpp:16: undefined reference to `SDL_CreateWindow' D:\c++\sdl\sdl\Debug/../src/sdl.cpp:19: undefined reference to `SDL_Delay' D:\c++\sdl\sdl\Debug/../src/sdl.cpp:22: undefined reference to `SDL_DestroyWindow' D:\c++\sdl\sdl\Debug/../src/sdl.cpp:23: undefined reference to `SDL_Quit' collect2.exe: error: ld returned 1 exit status
测试程序:
#include <SDL.h>
int main(int argc, char* argv[]) {
// Start SDL2
SDL_Init(SDL_INIT_EVERYTHING);
// Create a Window in the middle of the screen
SDL_Window *window = 0;
window = SDL_CreateWindow("Hello World!",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
640, 480,
SDL_WINDOW_SHOWN);
// Delay so that we can see the window appear
SDL_Delay(2000);
// Cleanup and Quit
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
任何人都知道发生了什么事?