error: no matching function for call to 'std::exception:exception(const char[16])'

环境:codeblocks

语言:C++

在执行:throw new exception("queue is empty.");

遇到问题:error: no matching function for call to 'std::exception:exception(const char[16])'

解决办法:修改为

std::logic_error e("xxx.");
throw std::exception(e);

记得:

#include <iostream>

using namespace std;

原文地址:https://www.cnblogs.com/zkfopen/p/10490897.html