| | |
struct type redefinition
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
ADT.h
Why am I getting errors:
'process' : 'struct' type redefinition
'node' : 'struct' type redefinition
'queue' : 'class' type redefinition
C++ Syntax (Toggle Plain Text)
struct process { int pid; // process id char* file_name; // file name of the process to be run int cpu_time; // amount of time the process needs with the cpu int request_priority; // priority from 1-5 (higher is better) int pr; // adjusted priority rate }; /**********************************************************************/ /***** A NODE OF OUR BINARY TREE /**********************************************************************/ struct node { process key; // pointers to child nodes node *left; node *right; }; /**********************************************************************/ /***** ADT PRIORITY QUEUE HEAP STRUCTURE (BINARY TREE) /**********************************************************************/ class queue { node* root; void insert(process, node*); // helper function for public insert() public: queue(); // constructor function void insert(process); void traverse(node*); bool isEmpty(); };
Why am I getting errors:
'process' : 'struct' type redefinition
'node' : 'struct' type redefinition
'queue' : 'class' type redefinition
•
•
•
•
Originally Posted by cscgal
Why am I getting errors:
'process' : 'struct' type redefinition
'node' : 'struct' type redefinition
'queue' : 'class' type redefinition
It compiles fine with g++, maybe try:struct process
{
int pid; // process id
char* file_name; // file name of the process to be run
int cpu_time; // amount of time the process needs with the cpu
int request_priority; // priority from 1-5 (higher is better)
int pr; // adjusted priority rate
};
/************************************************** ********************/
/***** A NODE OF OUR BINARY TREE
/************************************************** ********************/
struct node
{
process key;
// pointers to child nodes
node *left;
node *right;
};
/************************************************** ********************/
/***** ADT PRIORITY QUEUE HEAP STRUCTURE (BINARY TREE)
/************************************************** ********************/
class queue
{
node* root;
void insert(struct process, struct node*); // helper function for public insert()
public:
queue(); // constructor function
void insert(struct process);
void traverse(struct node*);
bool isEmpty();
};
0
#3 Aug 26th, 2003
Grr do I hate this! All these days playing around and finally I figured out my problem. Visual C++ seems to have a problem with #include<iostream.h> but instead will only allow me #include<iostream>
•
•
•
•
Originally Posted by cscgal
Grr do I hate this! All these days playing around and finally I figured out my problem. Visual C++ seems to have a problem with #include<iostream.h> but instead will only allow me #include<iostream>
Yeah, it's for a class. My professor only cares about the algorithm, not the language. You can write in C, C++, or Java, whichever you're most comfortable in.
If anyone's curious, this is the same program as is discussed here: http://www.daniweb.com/forums/thread938.html
•
•
•
•
Originally Posted by cscgal
If anyone's curious, this is the same program as is discussed here: http://www.daniweb.com/forums/thread938.html
Last edited by subtronic; Aug 26th, 2003 at 1:13 pm.
![]() |
Similar Threads
- Compile problems with visual studio 2008 (C++)
- winsock problem (C++)
- WinSock problems. (C++)
Other Threads in the C++ Forum
- Previous Thread: Converting byte value into integer and vice versa
- Next Thread: Error Linking KeyLogger.exe
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






