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 / Multi include files

Author
Message
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 8th Jan 2005 09:23
Hi everyone,
Just starting to convert my game over to darkgame sdk, and in the process learn c++.

what i am trying to do is place all the keyboard and joy stick code all in one file that is include, this is what i ahve so far


the problem Iam having is how do i get the code in the main file to see this, i tried including the header file but then i get linker error, so i tried adding enum tKey Key; but then i got errors that "error C2228: left of '.Up' must have class/struct/union type
type is 'tKey'"

and so on for each of the varibles in that type. do i need to enum one more ting or am i compltly lost on this,

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
Dominus
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 8th Jan 2005 09:51 Edited at: 8th Jan 2005 09:52
What development environment are you using? This would help determine why you might be seeing these errors.

I copied your code into a DarkSDK application that I had worked on and it compiled and linked without any complaints.

Here is the Test.h file that I created:


And here is the Test.cpp file that I created:


All I changed was to add the DarkSDK.h include to the beginning of the cpp file, as it wouldn't compile without it.

I am using Visual C++ 6.0 and the application compiled without any errors. You might try using these two source listings and see if you get the same error.

If you can post additional information it will help.

Thanks.

Stephen Abbott
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 8th Jan 2005 12:52 Edited at: 8th Jan 2005 12:53
i guess i tye that out a little to fast forgot one part, I am trying to move that part of the code to it's ove cpp and h file, my main file is


and the header for that.



and i have the #include "DarkSDK.h" in my stdafx.h

and i am using vc++ .net 2003

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 8th Jan 2005 13:12
1) Why do you use an array of size 1? Its not necessary, just make it a variable.

2) Enum is short for enumeration. So that means each item in the enumeration has a value associated with it. Its similar to a constant. So you would use an enum similar to a constant in the code. So thats why you are getting the class/struct error. What you should do is make tKey a struct. Then at least that error will go away.

3) Can you show us the linker error(s)?
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 8th Jan 2005 13:19
thanks for the quick reply. her eis the compiler errors



http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 8th Jan 2005 13:21 Edited at: 8th Jan 2005 13:24
Do you still get that if you make the array a variable instead and make tKey a struct instead of enum?
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 8th Jan 2005 13:39
ok i follow you on making array into a varible and i have done that, but what are you talking about tKey a struct instead of enum, for some reason i though i need the enum to reference, the type that in controll.h and that the ones in my first post.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 8th Jan 2005 16:16
Try this:



Then put "key" in place of all the "key[0]".
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 9th Jan 2005 02:33
if i put that struct in my main header file i get error linking cause its allready defined in controll.h. maybe if you see what i am trying to do, and how the project is setup, you could see what i am doing wrong.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com

Attachments

Login to view attachments
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 9th Jan 2005 03:56
You didnt include controll.h anywhere. So I added it to the top of dragon_warrior.h. So that got rid of all the errors except now I get an error saying I dont have bitmp1.bmp. Guess thats some media you didnt give me.
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 9th Jan 2005 04:08
oh that file i didn't think that was important. when i added controll.h to the heard of dragon warrior i got link error so i thought that was wrong. the error are
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
Dragon_Warrior.obj : error LNK2005: "struct tKey Key" (?Key@@3UtKey@@A) already defined in Controll.obj
Dragon_Warrior.obj : warning LNK4006: "struct tKey Key" (?Key@@3UtKey@@A) already defined in Controll.obj; second definition ignored
Creating library Game\Dragon_Warrior.lib and object Game\Dragon_Warrior.exp
Game\Dragon_Warrior.exe : fatal error LNK1169: one or more multiply defined symbols found

and here is that bitmat1 file. could you see if it will compile for you.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com

Attachments

Login to view attachments
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 9th Jan 2005 05:38
I see the problem. Ok in your Controll.h. Turn this:

To this:


Then put the original Key declaration in Dragon_Warrior.h. That should fix it, did for me.
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 9th Jan 2005 06:46
thanks billy for all the help, now i know what i was missing. it all makes sense now.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
billy the kid
19
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 9th Jan 2005 10:55

Login to post a reply

Server time is: 2024-03-29 11:10:45
Your offset time is: 2024-03-29 11:10:45