error C2065: 'fstream' : undeclared identifier error C3861: 'opfile': identifier not found

问题:

     

1>compute.cpp

1>f:/programe/compute/compute.cpp(15) : error C2065: 'fstream' : undeclared identifier

1>f:/programe/compute/compute.cpp(15) : error C2146: syntax error : missing ';' before identifier 'opfile'

1>f:/programe/compute/compute.cpp(15) : error C3861: 'opfile': identifier not found

1>Build log was saved at "file://f:/programe/compute/Debug/BuildLog.htm"

1>compute - 3 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

解决方法:

 

在程序头部加上如下语句:

 

#include <iostream>

#include <fstream>

using namespace std;   //加上这句就行了,但这句不能放于首行

你可能感兴趣的:(c,File,Build)