Sign in to follow this  
chapinch

libraray not compitable

Recommended Posts

Hi All I have been studying c++ for over a year now and have decided to dable a bit in the games side of things, I have bought a book call GAME PROGRAMMING IN C++: START TO FINISH, by Erik Yuzwa. It is an asteriod game. I have tried to run a sample program on my computer that uses SDL see below. I have linked up the peon engine that I am using to my compiler (VC2008) and the SDL also but this error occurs: 1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library Do you have any ideas on how I can solve this. /** * 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("data\\textures\\sdl_logo.bmp"); //create the working SDL_Surface which matches the //display format of the temporary surface SDL_Surface* bg = 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; } PS: I have encountered a number of errors trying to run this simple program and have managed to solve them all but this one I am stumped. Vista what I am using wasn't out when the book was published in 2005 but there is a mention of it and the author was aware if this helps.

Share this post


Link to post
Share on other sites
Have you changed the default runtime library setting? It needs to be the DLL version as per this thread where exactly the same error is reported.

Possibly the Peon engine has been compiled against a different version of the library, in which case unless you can recompile Peon, you can try setting the /NODEFAULTLIB:library option through the Additional Options box in the Command Line section of the properties, although I'm not sure what the wider implications of doing this are.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this