I want to use the string class in my program but I keep getting the following errors:
process.cpp:10: error: 'string' has not been declared
process.cpp:10: error: prototype for 'Process:: Process(int, int, int)'
does not match any in class 'Process'
process.h:14: error: candidates are: Process:: Process(const Process&)
process.h:16: error: Process:: Process(int, char*, int)
process.cpp: In constructor 'Process:: Process(int, int, int)':
process.cpp:14: error: invalid conversion from 'intâ to âchar*'
make: *** [process.o] Error 1
I don't understand why I'm getting this since my code doesn't seem to differ from the examples I found in tutorials too much:
/*
* process.h
*
* Created on: Oct 13, 2009
* Author: NTUser1
*/
#ifndef PROCESS_H_
#define PROCESS_H_
#include "thread.h"
#include <string>
#include <iostream>
using namespace std;
class Process : public Thread
{
public:
Process(int at, string process, int bt);
int arrivalTime; // arrival time of a process
string name; // process name, e.g., P0, P1, P2
int burstTime; // CPU burst time of a process
int remainTime; // the remaining burst time of a process
void run();
private:
};
/*
* process.cpp
*
* Created on: Oct 13, 2009
* Author: NTUser1
*/
#include "process.h"
Process::Process(int at, string process, int bt){
arrivalTime = at;
burstTime = bt; //etc for the rest of the vars
name = process;
}
void Process::run(){
state = RUNNING;
sleep(burstTime);
stop();
}