PDA

View Full Version : problem at the compilation to display a window with SDL and opengl



airseb
06-16-2003, 12:29 PM
Hi !
can you help me ?
i do that and i have errors :


#include <SDL.h>
#include <SDL_opengl.h>
#pragma comment(lib, "SDL.lib")
void main ()
{ SDL_Init( SDL_INIT_VIDEO ) ;

SDL_SetVideoMode( 640, 480, 32, SDL_OPENGL ) ;
}


these are the errors :
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/fenetre_SDL.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

fenetre_SDL.exe - 2 error(s), 0 warning(s)

I also tried this :


#include <SDL.h>
#include <SDL_opengl.h>
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
void main ()
{
SDL_Init( SDL_INIT_VIDEO ) ;
SDL_SetVideoMode( 640, 480,32,SDL_OPENGL ) ;
}


and i get this :
Linking...
msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol _SDL_main
Debug/fenetre_SDL.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

fenetre_SDL.exe - 6 error(s), 1 warning(s)

i don't understand.
can you help me ?

[This message has been edited by airseb (edited 06-16-2003).]

[This message has been edited by airseb (edited 06-16-2003).]

kansler
06-17-2003, 01:02 AM
Maybe you should read the documentation before you post here. I found the solution for your problem on this site:
http://www.libsdl.org/faq.php