首先,我已经查找了解决方案,我似乎无法修复它。当试图编译源代码时,我得到以下错误。错误:未定义标识符“ostream”
g++ -c -I/home/jcallahan/ACM/include/FANSI -I/home/jcallahan/ACM/FourtyTwo/Base -I/home/jcallahan/ACM/FourtyTwo/FunctionSpaces -I/home/jcallahan/ACM/FourtyTwo/MeshLib LagrangeFunctions.cpp In file included from /home/jcallahan/ACM/include/FANSI/MatrixVector.h:6:0, from LagrangeFunctions.cpp:17: /home/jcallahan/ACM/include/FANSI/Matrix.h:184:24: error: ‘ostream’ has not been declared void WriteToTextFile(ostream &) ;
该错误是从包括Matrix.h和Vector.h未来(I有更多的这些错误只示出一个)。我相信错误在Matrix.h/Vector.h。代码被切断了,因为我不认为类成员函数与它有任何关系。
#include "AbstractMatrix.h"
class Matrix : public AbstractMatrix
{
friend std::ostream &operator<<(std::ostream &,const Matrix &) ;
friend std::istream &operator>>(std::istream &, Matrix &) ;
public:
任何人都有任何线索怎么回事或我该如何解决它?有关其他信息,我正在使用g ++编译器。
加上'#包括'到您的文件 –
Mgetz
的顶部看来你的头一个使用'ostream'无资质('的std ::'),并没有合适的'using'声明或'using'指令。与资格无关,合适的标题(''或'')也可能会丢失。 –
Mgetz, 我加入了include,它没有改变任何东西。 Dietmar, 我没有在任何头文件中使用“命名空间标准”,但只有这一个给我一个问题。当编译使用PGI编译器时,它编译时没有问题 – jgCallahan