I get this error when compiling an sdl project i have please help me as i cant learn anything until i get my new compiler setup im using visual studi c++ 2010 the free edition i use to use code blocks but have upgraded heres my error:

1>------ Build started: Project: Builder, Configuration: Debug Win32 ------
1>main.obj : error LNK2005: "public: __thiscall BLOCK::BLOCK(void)" (??0BLOCK@@QAE@XZ) already defined in block.obj
1>main.obj : error LNK2005: "public: void __thiscall BLOCK::DoDrop(struct SDL_Rect)" (?DoDrop@BLOCK@@QAEXUSDL_Rect@@@Z) already defined in block.obj
1>main.obj : error LNK2005: "public: void __thiscall BLOCK::ShowBlock(void)" (?ShowBlock@BLOCK@@QAEXXZ) already defined in block.obj
1>main.obj : error LNK2005: "struct SDL_Surface * __cdecl LoadImage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?LoadImage@@YAPAUSDL_Surface@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in functions.obj
1>main.obj : error LNK2005: "void __cdecl ApplySurface(int,int,struct SDL_Surface *,struct SDL_Surface *,struct SDL_Rect *)" (?ApplySurface@@YAXHHPAUSDL_Surface@@0PAUSDL_Rect@@@Z) already defined in functions.obj
1>main.obj : error LNK2005: "bool __cdecl CheckCollision(struct SDL_Rect,struct SDL_Rect)" (?CheckCollision@@YA_NUSDL_Rect@@0@Z) already defined in functions.obj
1>main.obj : error LNK2005: "bool __cdecl Init(void)" (?Init@@YA_NXZ) already defined in functions.obj
1>main.obj : error LNK2005: "bool __cdecl LoadFiles(void)" (?LoadFiles@@YA_NXZ) already defined in functions.obj
1>main.obj : error LNK2005: "void __cdecl CleanUp(void)" (?CleanUp@@YAXXZ) already defined in functions.obj
1>main.obj : error LNK2005: "struct SDL_Rect wall2" (?wall2@@3USDL_Rect@@A) already defined in globals.obj
1>main.obj : error LNK2005: "struct SDL_Rect blockBox" (?blockBox@@3USDL_Rect@@A) already defined in globals.obj
1>main.obj : error LNK2005: "struct SDL_Rect wall" (?wall@@3USDL_Rect@@A) already defined in globals.obj
1>main.obj : error LNK2005: "union SDL_Event event" (?event@@3TSDL_Event@@A) already defined in globals.obj
1>main.obj : error LNK2005: "int const SCREEN_WIDTH" (?SCREEN_WIDTH@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const SCREEN_HEIGHT" (?SCREEN_HEIGHT@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const SCREEN_BPP" (?SCREEN_BPP@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const FRAMES_PER_SECOND" (?FRAMES_PER_SECOND@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const SQUARE_WIDTH" (?SQUARE_WIDTH@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const SQUARE_HEIGHT" (?SQUARE_HEIGHT@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const BLOCK_WIDTH" (?BLOCK_WIDTH@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "int const BLOCK_HEIGHT" (?BLOCK_HEIGHT@@3HB) already defined in globals.obj
1>main.obj : error LNK2005: "struct SDL_Surface * playerTexture" (?playerTexture@@3PAUSDL_Surface@@A) already defined in globals.obj
1>main.obj : error LNK2005: "struct SDL_Surface * blockTexture" (?blockTexture@@3PAUSDL_Surface@@A) already defined in globals.obj
1>main.obj : error LNK2005: "struct SDL_Surface * screen" (?screen@@3PAUSDL_Surface@@A) already defined in globals.obj
1>main.obj : error LNK2005: "class BLOCK myBlock" (?myBlock@@3VBLOCK@@A) already defined in globals.obj
1>main.obj : error LNK2005: "class PLAYER player" (?player@@3VPLAYER@@A) already defined in globals.obj
1>player.obj : error LNK2005: "public: __thiscall PLAYER::PLAYER(void)" (??0PLAYER@@QAE@XZ) already defined in main.obj
1>player.obj : error LNK2005: "public: void __thiscall PLAYER::HandleInput(void)" (?HandleInput@PLAYER@@QAEXXZ) already defined in main.obj
1>player.obj : error LNK2005: "public: void __thiscall PLAYER::Move(void)" (?Move@PLAYER@@QAEXXZ) already defined in main.obj
1>player.obj : error LNK2005: "public: void __thiscall PLAYER::Show(void)" (?Show@PLAYER@@QAEXXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: __thiscall TIMER::TIMER(void)" (??0TIMER@@QAE@XZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: void __thiscall TIMER::Start(void)" (?Start@TIMER@@QAEXXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: void __thiscall TIMER::Stop(void)" (?Stop@TIMER@@QAEXXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: void __thiscall TIMER::Pause(void)" (?Pause@TIMER@@QAEXXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: void __thiscall TIMER::Unpause(void)" (?Unpause@TIMER@@QAEXXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: int __thiscall TIMER::GetTicks(void)" (?GetTicks@TIMER@@QAEHXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: bool __thiscall TIMER::IsStarted(void)" (?IsStarted@TIMER@@QAE_NXZ) already defined in main.obj
1>timer.obj : error LNK2005: "public: bool __thiscall TIMER::IsPaused(void)" (?IsPaused@TIMER@@QAE_NXZ) already defined in main.obj
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Chris\Documents\Visual Studio 2010\Projects\Builder\Debug\Builder.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The error is in your code, not the compiler. You have written functions within a header file, then included that header file in two or more *.cpp files. You can't do that because you will get duplicate declaratkion errors just as you found out. Move those functions from header file into *.cpp file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.