•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,485 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,780 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 15406 | Replies: 7
![]() |
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,019
Reputation:
Rep Power: 33
Solved Threads: 116
ADT.h
Why am I getting errors:
'process' : 'struct' type redefinition
'node' : 'struct' type redefinition
'queue' : 'class' type redefinition
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
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
•
•
Originally Posted by cscgal
Why am I getting errors:
'process' : 'struct' type redefinition
'node' : 'struct' type redefinition
'queue' : 'class' type redefinition
My first guess is you're using Visual C++
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();
};
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,019
Reputation:
Rep Power: 33
Solved Threads: 116
#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>
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
•
•
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>
Oh I guess that makes sense. The last time I used g++ 3.something it yelled at me about those header files being deprecated. I take it you're programming for a class? I though most universities were phasing C++ out for Java?
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,019
Reputation:
Rep Power: 33
Solved Threads: 116
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.
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,019
Reputation:
Rep Power: 33
Solved Threads: 116
If anyone's curious, this is the same program as is discussed here: http://www.daniweb.com/forums/thread938.html
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
•
•
Originally Posted by cscgal
If anyone's curious, this is the same program as is discussed here: http://www.daniweb.com/forums/thread938.html
Do you still need help with this homework? I take it you're programming a heap and using heap sort to implement the priority queue? Can you choose any stradegy for sending/storing to a queue; there's a couple good ways of multiplexing your "processor".
Last edited by subtronic : Aug 26th, 2003 at 1:13 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- winsock problem (C++)
- put a struct type val in a FILE (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



Linear Mode