but if I don't have main() then I get undefined reference to SDL_main..so what the crap is with this!?
and then when I include all those libraries,(only iostream, cstdlib, and SDL.h are included) the console window will be there, but it won't let me print anything to it..I have tried printf, cout, and fprintf(stderr,"bah") but nothing works!
edit:
Well I figured out the console window problems came back to -lmingw32 and I fixed the undefined reference created by using this code
Code: Select all
#ifdef WIN32 //This will overcome the bugs with MingW and GCC
int main(int argc,char**v){}
//int SDL_main(int t,char **v){}
extern "C" int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
#else
int main(int argc,char **argv)
#endif
{
//code follows..
and my makefile command came down to
Code: Select all
g++ $(_CFLAGS) -c main.cpp -o obj/main.o
g++ $(_OBJS) -lSDL -o Robots_AI.exe