Sign in to follow this  

SDL HelloWorld HELP!!!

This topic is 3094 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

Please help, I try to get the HelloWorld work. I put the SDL.dll in the debug folder. But I got the errors as following. ____ERRORSSSSSSSS________ 1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------ 1>Linking... 1>test.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_UpdateRect referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_UpperBlit referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main 1>test.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>C:\Users\...\projects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 11 unresolved externals 1>Build log was saved at "file://c:\Users\..\projects\HelloWorld\HelloWorld\Debug\BuildLog.htm" 1>HelloWorld - 12 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== /** * This source code is part of the samples for "Game Programming in C++: Start to Finish". * * This example SDL code will load up a bitmap image of the SDL logo, and just display * it in a window for you. It's very bare bones. * * @Author : Erik Yuzwa * @Date : 09/01/2005 * @Version: 1.0 */ #include <SDL.h> int main(int argc, char* argv[]) { //initialize SDL and the video subsystem if(SDL_Init( SDL_INIT_VIDEO ) < 0) return -1; //create an SDL_Surface object which represents the //game window SDL_Surface *screen = SDL_SetVideoMode(640, 480, 0, 0); //signal SDL to change the text of the main window //to "Hello World" SDL_WM_SetCaption("Hello World", "Hello World"); //load the SDL logo bitmap to a temporary surface SDL_Surface* temp = SDL_LoadBMP("sdl_logo.bmp"); //create the working SDL_Surface which matches the //display format of the temporary surface SDL_Surface* bg = NULL; //SDL_DisplayFormat(temp); //free the memory allocated to the temporary SDL_Surface SDL_FreeSurface(temp); SDL_Event event; bool quit = false; //This is the main message loop of the game while(!quit) { //check the message queue for an event if (SDL_PollEvent(&event)) { //if an event was found switch (event.type) { //check to see if the window was closed via the "x button" case SDL_QUIT: //set the quit flag to true quit = true; break; //check the keyboard to see if the ESC key was pressed case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_ESCAPE: //set our quit flag to true quit = true; break; } break; } } //draw the background sprite SDL_BlitSurface(bg, NULL, screen, NULL); //update the current window SDL_UpdateRect(screen, 0, 0, 0, 0); } //free the allocated memory for the background surface SDL_FreeSurface(bg); //quit SDL and allow it to clean up everything SDL_Quit(); //return control to Windows with no errors return 0; }

Share this post


Link to post
Share on other sites

This topic is 3094 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.

Guest
This topic is now closed to further replies.
Sign in to follow this