这应该算是一个C语言遗留问题。
问题出现条件:
#include <fstream.h>后有语句using namespace std;
比如
#include <fstream.h>
#include <string>
using namespace std;
分析:
fstream 和 fstream.h是两个不同的文件。前者是C++标准化以后的,后者是C++标准化之前的。如果包含了fstream.h之后再用using namespace std,编译器就不知道用哪一个文件了。
解决办法:
1,把#include <fstream.h>换成#include <fstream>
2,把using namespace std;换成using std::string;
ERROR: 'fstream' : ambiguous symbol
最新推荐文章于 2021-11-03 20:21:23 发布