So, I'm trying to install SDL2 in Eclipse for C++ using MinGW, but I cant get the test program from the tutorial by Cave of Programming to build. I've put all the files the tutorial said to into their respective locations. I'm using version 2.0.5 of SDL.
Here are my eclipse settings.
The build error log:
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
The test program:
#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;
}
Anyone have an idea what's going on?