To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3462
3461  |  3463
Subject: 
Linked Lists in BrickOS
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 7 Oct 2003 20:59:51 GMT
Viewed: 
2809 times
  
Thanks to all that assisted me in getting set up. It turned out to be missing
Cygwin packages. My bad.

Two problems. Firstly, BrixCC needs to be restarted to compile 'new' code. Is
there a way to correct this problem?

Also, I'm having trouble setting up a linked list in BrickOS. The final
application is an AI tree (eventually with alpha-beta pruning). I've done this
sort of project before in Pascal, but the dud code below isn't compiling, so I
just wanted to check that brickOS classes/structs can contain pointers to
themselves. (and that I'm not just making some stupid syntaxual error)

#include <conio.h>
#include <unistd.h>
#include <dsound.h>

class Node
{
public:
Node( void *_pData )
{
pData = _pData;
pNext = NULL;
} // end constructor

Node *Next() { return( pNext ); }
void SetNext( Node *pNode ) { pNext = pNode; }
//void *Data() { return( pData ); }

private:
//void *pData;
Node *pNext;
}; // end Node

class list
{

private:
    Node *p_head
}

int main(int argc, char **argv)
{
  cputs("c4");
  return 0;
}

The actual errors are really bizarre stuff like parser problems on 'class Node'



Message has 3 Replies:
  Re: Linked Lists in BrickOS
 
In lugnet.robotics.rcx.legos, Michael Purvis wrote: <snipped some, added some filler> (...) In order for the above to work.... (...) wouldn't the above need to be uncommented ??? I am not seeing where else you declared pData... but I could be wrong. (...) (21 years ago, 7-Oct-03, to lugnet.robotics.rcx.legos)
  Re: Linked Lists in BrickOS
 
(...) Also, add some semicolons to the above like so: class list { private: Node *p_head; }; Mark (21 years ago, 7-Oct-03, to lugnet.robotics.rcx.legos)
  Re: Linked Lists in BrickOS
 
(...) BricxCC can't know for sure what compiler to use unless it can tell what type of file you are editing. It figures this out using the file extension. In order to compile C++ and C code, BricxCC needs the file to have a .cpp or .c extension. (...) (21 years ago, 8-Oct-03, to lugnet.robotics.rcx.legos)

8 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR