4 Attachment(s)
SDL on visual studio errors! i need help!
hey guys, i have been trying to get SDL to work so i can make a game but i cant for the life of me get it to work! i am on visual studio 2012 and i have done everything they say to do on lazyfoo.net on how to install SDL, here is my code:
main.cpp:
Code:
#include"SDL.h"intmain( intargc, char* args[] ){ //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); //Quit SDL SDL_Quit(); return 0; }
source:
Code:
#include"SDL.h"constint WINDOW_WIDTH = 640;constint WINDOW_HEIGHT = 480;constchar* WINDOW_TITLE = "SDL Start"; intmain(intargc, char **argv){ SDL_Init( SDL_INIT_VIDEO ); SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0, SDL_HWSURFACE | SDL_DOUBLEBUF ); SDL_WM_SetCaption( WINDOW_TITLE, 0 ); SDL_Surface* bitmap = SDL_LoadBMP("\resources\sprites\MONO\spr_MONO.bmp"); // Part of the bitmap that we want to drawSDL_Rect source; source.x = 24; source.y = 63; source.w = 65; source.h = 44; // Part of the screen we want to draw the sprite toSDL_Rect destination; destination.x = 100; destination.y = 100; destination.w = 65; destination.h = 44; SDL_Event event; bool gameRunning = true; while (gameRunning) { if (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { gameRunning = false; } } SDL_BlitSurface(bitmap, &source, screen, &destination); SDL_Flip(screen); } SDL_FreeSurface(bitmap); SDL_Quit(); return 0;}
and this is what i am getting when i run it:
Code:
1>------ Build started: Project: MONO, Configuration: Debug Win32 ------
1>Source.obj : error LNK2005: _SDL_main already defined in main.obj
1>main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
1>Source.obj : error LNK2001: unresolved external symbol _SDL_Init
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_Init
1>main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main
1>Source.obj : error LNK2001: unresolved external symbol _SDL_Quit
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_Quit
1>Source.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_Flip referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_UpperBlit referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function _SDL_main
1>Source.obj : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function _SDL_main
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_SetModuleHandle referenced in function _main
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_GetError referenced in function _main
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_strlcpy referenced in function _main
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_getenv referenced in function _WinMain@16
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_strlcat referenced in function _redirect_output
1>C:\...\MONO\Debug\MONO.exe : fatal error LNK1120: 15 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
i have the SDL.dll, SDL.lib, and the SDLmain.lib in \MONO\Debug and here is what i did in the properties: Attachment 12623Attachment 12624Attachment 12625Attachment 12626than in linker -> additional dependence i have "SDLmain.lib"if you can help me that would be great! thank you so much!