首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

控制台程序使用<Afxtempl.h>出错,如何解决

2012-04-09 
控制台程序使用Afxtempl.h出错,怎么解决?C/C++ code#includeiostream#include Afxtempl.husing name

控制台程序使用<Afxtempl.h>出错,怎么解决?

C/C++ code
#include<iostream>#include <Afxtempl.h>using namespace std;class Car{public:    void setLen(int len){        c_lenth = len;    }    void setWid(int wid){        c_width = wid;    }    int getLen(){        return c_lenth;    }    int getWid(){        return c_width;    }private:    int c_lenth;    int c_width;};void main(){    int i=10;    cout << i;}


为什么include<Afxtempl.h>,cout语句就无法使用?如何解决?

错误信息:
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) 已经在 libcpmt.lib(newaop.obj) 中定义
1>E:\运动目标分类\目标分类代码版本\毕业设计实验\test\Debug\test.exe : fatal error LNK1169: 找到一个或多个多重定义的符号


[解决办法]

如果要使用mfc的类 就用mfc程序 用控制台引用mfc的类 有可能会出异常

热点排行