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 / Unknown error

Author
Message
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 00:26
I really don't know what to do here. I finally started putting the pieces together on my RPG. But, when I compile, I get one error:



I checked, and I don't use the word constant once in all of my code. That line is creation of an object of the type cTileMap. Here is the cTileMap class definition:



I have no idea where the error is coming from.
pirogoth
17
Years of Service
User Offline
Joined: 6th Apr 2008
Location: Good Old California
Posted: 6th Jul 2008 01:02
Just to check, this is your Game.h file, correct?

Now if it is, I don't see any issue with that line, but I do see a problem.


That line should actually be this:

Notice the extra space? The compiler will pick that up as a stream extraction operator (">>") otherwise. It's possible this is causing the error, but I doubt it. Any other information you can give us?

-Piro
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 01:19
It's actually the definition of the cTileMap class. In line 9 of Game.h, an instance of this class is created.

I've always had it without that space, and it's worked just fine. I don't know what it could be. :/
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 01:21
Here's Game.h:



Hope that helps.
pirogoth
17
Years of Service
User Offline
Joined: 6th Apr 2008
Location: Good Old California
Posted: 6th Jul 2008 01:30
That line's calling the constructor for cTileMap. Mind if I see it's implementation? Your cTileMap definition has an empty constructor with no arguments, and just a definition for the constructor with two arguments (ints). Mind showing the code for that?

-Piro
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 01:35
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 19:24
I still can't find the error.

So, here's all the code. If I missed any, tell me, and I can upload it.

Attachments

Login to view attachments
Lilith
17
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th Jul 2008 21:30
I think I've found it.

You're declaring a class object with initializers which, apparently, is the same as trying to initialize a constant inside another class (cGame) rather than through the constructor. If I take out the "32, 32" the constant error goes away. Or course, it's not initializing things the way you'd want.

Unfortunately, I'm picking up another error that you didn't mention.

c:\c#\mahoney\mahoney\game.cpp(13) : error C2228: left of '.load_map' must have class/struct/union

which is an indication that it doesn't recognize the class that overworld_map is supposed to represent.

I'm not sure what's going on there since everything seems to be in place.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 22:17
Actually, that error is due to the fact that it can't initialize the class that is causing the error.

Alright. So, I should initialize the cTileMap object in the constructor for cGame, and make a pointer to it as a private variable?
Lilith
17
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th Jul 2008 22:39
I'm not sure. It goes against my grain to instantiate an object and then have to follow it up with another function call. But I'd instantiate the cTimeMap object without the initializers and then follow that up with a function call to set the tile sizes.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 23:09
It can now make the object, but it still gives this:



It won't let me use the object, just create it. :/
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 23:24
Got it:

Game.h


Game.cpp
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 23:31
Oops. This
should be
.
Lilith
17
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th Jul 2008 23:44
I could be wrong but if you make it static, then you should be able to used the "32, 32" initializer.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mahoney
17
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 6th Jul 2008 23:47
You're right. I can. Thanks for all the help.

Login to post a reply

Server time is: 2025-05-22 19:53:38
Your offset time is: 2025-05-22 19:53:38