Archived

This topic is now archived and is closed to further replies.

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

This topic is 5011 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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;
}

Share this post


Link to post
Share on other sites
still the same problem :/

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

try with other sdl functions : same problem :/

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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! :-)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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++.

Share this post


Link to post
Share on other sites