Archived

This topic is now archived and is closed to further replies.

Arggh! Damned Redefined Objects

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

I am currently trying to remake my Pong Game in OpenGL, except these new errors keep coming up. --------------------Configuration: Pong Unlimited Extreme - Win32 Debug-------------------- Linking... Bat.obj : error LNK2005: "void __cdecl glEnable2D(void)" (?glEnable2D@@YAXXZ) already defined in winmain.obj Bat.obj : error LNK2005: "void __cdecl glDisable2D(void)" (?glDisable2D@@YAXXZ) already defined in winmain.obj Bat.obj : error LNK2005: "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z) already defined in winmain.obj Bat.obj : error LNK2005: "int __cdecl InitGL(void)" (?InitGL@@YAHXZ) already defined in winmain.obj Bat.obj : error LNK2005: "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) already defined in winmain.obj Bat.obj : error LNK2005: "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) already defined in winmain.obj Bat.obj : error LNK2005: "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) already defined in winmain.obj Bat.obj : error LNK2005: "bool fullscreen" (?fullscreen@@3_NA) already defined in winmain.obj Bat.obj : error LNK2005: "bool active" (?active@@3_NA) already defined in winmain.obj Bat.obj : error LNK2005: "struct HWND__ * hWnd" (?hWnd@@3PAUHWND__@@A) already defined in winmain.obj Bat.obj : error LNK2005: "struct HDC__ * hDC" (?hDC@@3PAUHDC__@@A) already defined in winmain.obj Bat.obj : error LNK2005: "struct HGLRC__ * hRC" (?hRC@@3PAUHGLRC__@@A) already defined in winmain.obj Bat.obj : error LNK2005: "struct HINSTANCE__ * hInstance" (?hInstance@@3PAUHINSTANCE__@@A) already defined in winmain.obj Bat.obj : error LNK2005: "class CBat User" (?User@@3VCBat@@A) already defined in winmain.obj Bat.obj : error LNK2005: "class CBat Computer" (?Computer@@3VCBat@@A) already defined in winmain.obj Bat.obj : error LNK2005: "bool * keys" (?keys@@3PA_NA) already defined in winmain.obj Debug/Pong Unlimited Extreme.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. Pong Unlimited Extreme.exe - 17 error(s), 0 warning(s) I know what these errors mean, but I have no clue on how to go about fixing them? Any Input? We must defeat the trolls! Argh, we ARE the trolls!

Share this post


Link to post
Share on other sites
looks like your trying to redefine some functions and classes (and even variables...)-

combat this by using header guards-

#ifndef class_h
#define class_h

...

#endif


or....

make sure you declare your objects/variables in the .cpp file of a .h/.cpp pair...

or try to find where you are redefining these variables.... (use find...)

hope this helps


ps. daredevil is the worst movie made.

Share this post


Link to post
Share on other sites
Well, that worked to an extent.

Now I get this link error:

--------------------Configuration: Pong Unlimited Extreme - Win32 Debug--------------------
Compiling...
winmain.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Pong Unlimited Extreme.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Pong Unlimited Extreme.exe - 2 error(s), 0 warning(s)

Thanks for the input so far.

We must defeat the trolls!
Argh, we ARE the trolls!

Share this post


Link to post
Share on other sites