Home Download Buy Blog Forum Support

Getting C++ with SDL working?

Getting C++ with SDL working?

Postby floorman on Sat Jan 19, 2013 6:20 pm

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:
Code: Select all
#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:
Code: Select all
{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-lSDLmain", "-lSDL"]
}


The error returned is:
Code: Select all
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,
floorman
 
Posts: 5
Joined: Sat Feb 18, 2012 2:38 am

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 16 guests