【VC编译错误】error C2872: 'ofstream' : ambiguous symbol

描述:

今天VC6.0编译时,出现了:

error C2872: 'ofstream' : ambiguous symbol

的错误。

错误原因:

定义重复,编译器不知道想要的是哪个定义了

原语句:

ofstream file;

解决方法:

1、修改原语句为

::ofstream file;
//或
std::ofstream file;

2、修改头文件

#include <iostream>   
#include <fstream>

using namespace std;

  

PS:

  

posted @ 2012-12-28 16:05  断肠人在刷牙牙  阅读(1760)  评论(0)    收藏  举报