Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Linker Errors

Author
Message
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 3rd Aug 2009 11:19
Whenever I include this file more then once:



I get this error even though I've got include gaurds:

------ Build started: Project: Dark GDK - Test Game, Configuration: Debug Win32 ------
Compiling...
cbEntity.cpp
Main.cpp
Generating Code...
Linking...
cbEntity.obj : error LNK2005: "int __cdecl GetNextID(void)" (?GetNextID@@YAHXZ) already defined in Main.obj
Debug\Dark GDK - Test Game.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\Project1\Project1\Dark GDK - Test Game\Dark GDK - Test Game\Debug\BuildLog.htm"
Dark GDK - Test Game - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





Any help would be appreciated

#ifdef _in_programming_heaven_
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Aug 2009 12:47 Edited at: 3rd Aug 2009 12:50
You should put all code in .cpp files, and just put the function declarations in header files:

.h


.cpp


Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 3rd Aug 2009 13:36
You should try using "#pragma once", it's easier and it works the same as your header guards.

Login to post a reply

Server time is: 2024-10-01 08:47:53
Your offset time is: 2024-10-01 08:47:53