我有一个名为 BottlingPlant 的课程。我创建了以下头文件:
#ifndef __BOTTLINGPLANT_H__
#define __BOTTLINGPLANT_H__
#include <iostream>
class BottlingPlant {
public:
BottlingPlant( Printer &prt, NameServer &nameServer, unsigned int numVendingMachines, unsigned int maxShippedPerFlavour, unsigned int maxStockPerFlavour, unsigned int timeBetweenShipments );
void getShipment( unsigned int cargo[ ] );
void action();
};
#endif
以及以下 .cc 文件:
#include <iostream>
#include "PRNG.h"
#include "bottlingplant.h"
BottlingPlant::BottlingPlant( Printer &prt, NameServer &nameServer, unsigned int numVendingMachines, unsigned int maxShippedPerFlavour, unsigned int maxStockPerFlavour, unsigned int timeBetweenShipments ) {
}
void BottlingPlant::getShipment( unsigned int cargo[ ] ) {
}
void BottlingPlant::action() {
}
当我尝试编译 .cc 时,它在 .cc 和 .h 行中出现错误:
BottlingPlant::BottlingPlant( Printer &prt, NameServer &nameServer, unsigned int numVendingMachines, unsigned int maxShippedPerFlavour, unsigned int maxStockPerFlavour, unsigned int timeBetweenShipments )
说在token)
之前有一个expect。&
这对我来说没有任何意义,因为没有 open (
。我只是不确定为什么会出现此错误。Printer
并且NameServer
只是项目的一部分单独的类,但是..我是否也需要包含它们的头文件?
任何帮助是极大的赞赏!