#include "SDL.h"int main(int argc, char *argv[]){ if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); { SDL_Surface *screen; screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE); if ( screen == NULL ) { fprintf(stderr, "Unable to set 640x480 video: %s\n", SDL_GetError()); exit(1); } }return 0;}
It wont work, I get the errors
--------------------Configuration: SDL_test - Win32 Debug--------------------
Compiling...
main.cpp
C:\Program\Microsoft Visual Studio\MyProjects\SDL_test\main.cpp(8) : error C2065: 'exit' : undeclared identifier
Error executing cl.exe.
SDL_test.exe - 1 error(s), 0 warning(s)
And when I comment away all the code betwen main{ and } it gives me the errors
--------------------Configuration: SDL_test - Win32 Debug--------------------
Compiling...
main.cpp
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_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_SetModuleHandle
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_Quit
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_GetError
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_Init
Debug/SDL_test.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
SDL_test.exe - 9 error(s), 1 warning(s)
What hav I done wrong?
Thank you.