Sublime Forum

Getting C++ with SDL working?

#1

Hello,

Given I really suck with making build systems and normally steal others, I decided this time to try a build system with SDL for C++. However, I’m getting really unusual errors. Googling didn’t really help me.

code:

#include "SDL/SDL.h"
#include "iostream"

using namespace std;

int main(int argc, char *argv]) {
	SDL_Init(SDL_INIT_EVERYTHING);
	cout << "Debug." << endl;

	SDL_Delay(2000);

	SDL_Quit();
	return 0;
}

The build system I am using:

{
"cmd": "g++", "$file", "-o", "$file_base_name", "-lSDLmain", "-lSDL"]
}

The error returned is:

c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
[Finished in 0.4s with exit code 1]

Sorry for any schoolboy errors if there are any, but I am not seeing them.

What is wrong?

Thanks,

0 Likes