This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Initialising variables using new & referencing them


Initialising variables using new & referencing them

Postby Conan » Nov 3, 2002 @ 7:29pm

BurningSheep was helping me solve a memory issue. I was using up the stack instead of utilising the heap(I think)
All my variable definitions plus the structs which were giving me problems are in a MyGame.h file containing the definition of the MyGame class, all the function prototypes and variable definitions.

I cannot put the following line in this section
planet_data *planets = new planet_data[2000]; as I can only define the variables not give them a value. I get error C2258: illegal pure syntax, must be '= 0'
If I put the new statements in the MyGame init function then other functions cannot access them.

My code is split across various source files as eventually the game will be very big & I can;t keep it inside one source. This may have something to do with it.

Up till now I was manageing by creating the variable in the MyGame.h & giving it a value in the init function but I don;t see how to do this with 'new'
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Thanks to BurningSheep

Postby Conan » Nov 3, 2002 @ 8:00pm

My usage of new had a bug which is now solved thaks to BurningSheep. I hope you like space strategy games so I can give you a free registration :)
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


space? bring it on!

Postby HTK » Dec 14, 2002 @ 5:47pm

User avatar
HTK
pm Member
 
Posts: 132
Joined: Dec 14, 2002 @ 5:40pm


seeing a demo ?

Postby Conan » Dec 15, 2002 @ 11:37am

What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron