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

自定义异老是编译出错

2013-12-15 
自定义异总是编译出错#include exception#include stringclass wxdir_error:public std::exception{pu

自定义异总是编译出错

#include <exception>
#include <string>

class wxdir_error:public std::exception
{
public:
explicit wxdir_error (const std::string &s):std::exception(s.c_str()){}
};

class compiler_error:public std::exception
{
public:
explicit compiler_error (const std::string &s):std::exception(s.c_str()){}
};

class building_error:public std::exception
{
public:
explicit building_error (const std::string &s):std::exception(s.c_str()){}
};

为什么VC++就能顺利通过,MinGW总是编译错误?
新手求解
[解决办法]
引用:
也就是说我只需要继承,自己的exception里不需要写任何东西,是吧

写what()吧,必要时可以用来汇报,异常信息。

热点排行