The code is as follows:
#pragma once
#include <string>
class PCB {public
:
double pid;
Double runtime;
int priority;
String state;//(Waiting, ready_a, running, Terminate, BLOCK_A) (ready_s, block_s)
//pcb* next;
pcb* Pre;
static int ready; Number of Ready queue processes
static int exmem; External memory process number
static int POOL; Number of fallback queue processes
static int timestamp;//timestamp
pcb () {/*next = this;*/}
PCB (double rt, int pri): runtime (RT), Prio Rity (PRI) {
pid = TIMESTAMP;
state = "Waiting";
}
};
int PCB::P ool = 0;
int pcb::ready = 0;
int pcb::exmem = 0;
int pcb::timestamp = 0;
After long-term inspection →. →, because there is no using namespace std,string is std ~~~~/vomiting blood + sigh
Also, notice how the class static variables are initialized.
Every experiment on a variety of vomit, this is afraid of the wrong, this is not fine of the * *, sweat sweat sweat shame.
Attached reprint true · An unknown rewrite specifier causes the problem:
1. Circular references
In separate compilation, we tend to write different classes or functions separately in different functions, improve work efficiency. However, if two classes are written in two different files when they are used, and they are referenced to each other, a circular reference will be thrown to raise this error.
Solution: the predecessor declaration.
2. Syntax errors
This problem is mostly caused by carelessness, such as a semicolon in a member function, and a Chinese semicolon, and such an error will occur.
Solution: Modify the semicolon
3. Sequence errors for classes
If a member of a class contains another class, the life of the contained class must precede the containing class.