Compiling c++ source with dev-c++ & sdl

Started by
8 comments, last by Pegasus 20 years, 1 month ago
I''m tryng to compile this source whith dev-c++. #include <windows.h> #include <stdlib.h> #include "sdl/SDL.h" int main(int argc, char **argv) { if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) return 1; return 0; } in C no problem, but in C++ I''m getting this linker error : [Linker error] undefined reference to `__gxx_personality_v0'' Any hint how I could fix this? Thx in advance
Advertisement
Try This:

#include <windows.h>#include <cstdlib>#include "sdl/SDL.h"using namespace std;int main(int argc, char **argv){   if( SDL_Init( SDL_INIT_VIDEO ) < 0 )      return 1;   return 0;}
still the same problem :/

Apparently this problem occur when using sdl functions ( sdl_init in my case )

try with other sdl functions : same problem :/
Have you tried using <SDL.h> instead? "sdl/SDL.h" would mean that a directory SDL is in your current project's diretory, and within that is SDL.h. If you've set up your include directories properly, you should be able to use <SDL.h> or <sdl/SDL.h>

[edited by - GroZZleR on March 24, 2004 1:37:02 PM]
go to project/project options
go to the parameters tab
under linker you add -lstdc++

that should do the trick

hope that helps
Matt
Matt
wow thx lemurion!!!

search an explaination of this command on google but I didn''t found it, can you give me a little explaination of what it does?
Thx you! :-)
this is what i do to get sdl workign with devcpp:

add -lmingw32 -lSDLmain -lSDL to the linker parameters in your project.

#ifdef main#undef main#endif 


before int main(int argc, char** argv)

and of course install sdl mingw32 correctly.

(i prefer to install it right in the include directory so i can use instead of
quote:Original post by Pegasus
search an explaination of this command on google but I didn''t found it, can you give me a little explaination of what it does?
Thx you! :-)


it links your project against the standard C++ library
AFAIK you''ll need to do this with mingw32 when you want to compile C++ code

hope that helps
Matt
Matt
You should instead switch from gcc to g++ in the compiler options, do not use gcc for c++ code. If you do you''ll have to add -lstdc++ which is automatically linked by g++.
ok, its working perfectly with this command now ;-)
thx everyone for your help ;-)

This topic is closed to new replies.

Advertisement