forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dynamic memory allocation problem, please help

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
johnbo



Joined: 11 Jan 2006
Posts: 8

PostPosted: Wed Jan 11, 2006 12:35 pm    Post subject: dynamic memory allocation problem, please help Reply with quote

Hi can anyone help me please, im trying to make a linked list to store info for a pathfinding algorithm, i have some structs to hold info:

// node info structure
typedef struct
{
int f, g, h; // pathfinding evaluation parameters
MapPoint parent; // parent square
int state; // indicates whether square is on open list or not
}AInode;


// data structure to create linked list
typedef struct
{
AInode node;
struct ListNode* nxt;
}ListNode;


and im trying to create a new instance of the ListNode to be the root of the list:

// Create open list
ListNode* openRoot; // create pointer to root node
ListNode* openPtr; // create pointer to move aronud list

openRoot = new AInode; // make pointer point to reserved memery
openRoot->nxt = 0; // end of chain is NULL


but when i compile I get the following error:

error: 'new' undeclared


does anyone know why this does not work? im pulling my hair out. thanks
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Wed Jan 11, 2006 3:20 pm    Post subject: Reply with quote

..Are you building as C or C++ ?
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group