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 error - "Already defined"

Author
Message
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th May 2012 16:44 Edited at: 30th May 2012 17:33
Hi everyone

I don't know why, but for some reason Visual Studio 2008 doesn't like me including the GDK headers in "CApp.h". It shouldn't make a difference though. If I included them in "main.cpp", I'd have to go ahead and include them in every other source file as well, and doing that also gives me "Already defined" linker errors... What is going on?

Dark GDK is beginning to annoy me... It doesn't like the object oriented coding style.

Here's the entire source code:

main.cpp


CApp.h


CApp.cpp


CApp_OnExecute.cpp


CApp_OnInit.cpp


CApp_OnLoop.cpp


CApp_OnRender.cpp


CApp_OnCleanup.cpp


TheComet

WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th May 2012 16:58
I really don't know if it's still true with the new DarkGDK but PureGDK's h file "simpleWindow.h" had a function within it, and with the above code you've got, you're including that function (and not just a declaration to it) into all your other files. If that is so then Just include the "simpleWindow" once in the cpp that will be using it...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th May 2012 17:25
Aaah, perfect. I seperated the definitions from the declarations in both the files initDarkGDK.h and simpleWindow.h, created two new files initDarkGDK.cpp and simpleWindow.cpp along with some #ifndef stuff, and that fixed the problem.

Now, to create some games *cracks knuckles*

Oh one more thing, what's the deal with Dark GDK 2.0? Is the release candidate going to remain free, or will it expire at some point? Will it be free to use as long as it's not used commercially?

TheComet

prasoc
11
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 30th May 2012 18:30
I've had a bit of troubles with DGDK 2.0 aswell, sometimes the window just doesn't appear. It runs a *bit* slower than v1.0 but makes up for it in other features.

AFAIK, the release candidate will expire at some future time. You'll have to pay for it to make games with it. I think Mistrel is asking for input on how the free version should be limited (non-commercial, splash screen, etc.)


Fallout
17
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 30th May 2012 22:26
The order and process of including stuff in C++ is a pain in the bum. Every now and then I go down a design route only to find I'm going to have to reverse reference stuff and include A in B and B in A and all that rubbish!

It's a pain, but it's worth it when you get it sorted. Carnage is getting very complex slowly but surely, but it's remaining nicely organised thanks to OO.

Glad you sorted out your problem!

Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 30th May 2012 23:25
Include guards were missing from simpleWindow.h. This has been added for the next RC.

TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 31st May 2012 00:28
Awesome! I'm looking forward to the final release.

I forgot to post the modified files to show how I fixed the problem. Here they are below:

initDarkGDK.h


initDarkGDK.cpp


simpleWindow.h


simpleWindow.cpp


TheComet

Login to post a reply

Server time is: 2019-11-12 18:19:53
Your offset time is: 2019-11-12 18:19:53