Sign in to follow this  
Samsonite

Need some help deciphering weird build messages(SDL[VS2005])

Recommended Posts

Hello! And thanks for taking time! So, I thought just for a second to try out SDL. Since I can't find a good tutorial on ID3DXSprite. So after I wrote the code contained in this tutorial. I found myself surrounded by error messages. More specifically:
1>------ Build started: Project: SDL test app, Configuration: Debug Win32 ------
1>Linking...
1>msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>msvcrt.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
1>msvcrt.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4031: no subsystem specified; CONSOLE assumed
1>LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Documents and Settings\<my name>\My Documents\Visual Studio 2005\Projects\SDL test app\Debug\SDL test app.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Build log was saved at "file://c:\Documents and Settings\<my name>\My Documents\Visual Studio 2005\Projects\SDL test app\SDL test app\Debug\BuildLog.htm"
1>SDL test app - 5 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



I have linked both SDL.lib and SDLmain.lib via "Project"->"Properties"->"Linker"->"Input". Here is my code:
#include <SDL/SDL.h>
#include <string>

const int SCREEN_HEIGHT = 480; //window height
const int SCREEN_WIDTH = 640; //Window width
const int SCREEN_BPP = 32; //Bits per pixel

//Surfaces 

SDL_Surface* background = NULL;
SDL_Surface* message = NULL;
SDL_Surface* screen = NULL;

SDL_Surface* LoadImage(std::string filename)
{
	SDL_Surface* loadedimage = NULL; //Create a new surface

	SDL_Surface* optimizedimage = NULL; //Create yet another surface

	loadedimage = SDL_LoadBMP(filename.c_str());

		
	//If loading of image was succeded
	if(loadedimage !=NULL)
	{

		//Optimize image for 32 bit instead of 24 bit
		optimizedimage = SDL_DisplayFormat(loadedimage);

		//Free the old image
		SDL_FreeSurface(loadedimage);

		return optimizedimage;
	}
}

void Applyimage(int x, int y, SDL_Surface* source, SDL_Surface* dest)
{
	SDL_Rect rect;

	rect.x = x;
	rect.y = y;
		

	//Blit the surface to the surface designated by "dest"
	SDL_BlitSurface(source, NULL, dest, &rect);
}


//INT MAIN

int main(int argc, char* argv[])
{
	//Initialize SDL subsystems
	if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
	{
		return 1;
	}
	
	//return a pointer to a screen surface and assign it to "screen"
	screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);

	//If there was an error getting the screen up
	if(screen == NULL)
	{
		return 1; //End program
	}

	//Set window caption
	SDL_WM_SetCaption("Hello world!", NULL);

	//Load images
	message = LoadImage("hello.bmp");
	background = LoadImage("bg.bmp");

	//Apply the background to screen
	Applyimage(0, 0, background, screen);
	Applyimage(140, 180, message, screen);

	//Update the screen
	if(SDL_Flip(screen) == -1)
	{
		return 1;
	}

	//Wait two seconds
	SDL_Delay(2000);

	//Free surfaces
	SDL_FreeSurface(background);
	SDL_FreeSurface(message);

	SDL_Quit();
}




Thanks for any help in advance! [smile] [Edited by - Samsonite on March 6, 2006 1:01:50 PM]

Share this post


Link to post
Share on other sites
You may be trying to build it as a console app. Trying building it as a Win32 GUI application. Make sure your runtime libraries are Multi-threaded DLL.

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