c++ - 我在代码中的几行中得到了这个 "warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)"

标签 c++ visual-c++

如何解决这个警告?由于此警告,代码无法继续编译。请给我一些建议!太感谢了!我复制了代码的四个部分 警告指向。

 template <typename T>
std::vector<StructNodeElem<T> *> *_groupStructOfString(const char *data) throw(const char *){
  std::istringstream is(data);
  std::vector<StructNodeElem<T> *> *gstruct = new std::vector<StructNodeElem<T> *>;


template <typename T>
std::vector<StructNodeElem<T> *> *_readGroupStruct(const char *file) throw(const char *){
  std::ifstream infile;
  infile.open (file, ifstream::in);
  if(! infile.good())
    throw("readGroupStruct: cannot open file");


template <typename T>
std::vector<StructNodeElem<T> *> *_simpleGroupTree(int *degr, int n) throw(const char *){
  std::vector<int> degrees;
  for(int i = 0;i < n;i++)
    degrees.push_back(degr[i]);




template <typename T>
Vector<T> *_graphOfGroupStruct(std::vector<StructNodeElem<T> *> *gstruct,SpMatrix<bool> **pgroups,SpMatrix<bool> **pgroups_var) throw(const char *) {
  int nb_vars;
  Vector<T> *peta_g;
  if (! checkGroupTree<T>(gstruct,false,&nb_vars))
    throw("graphOfGroupStruct: bad input data");




template <typename T>
int _treeOfGroupStruct(std::vector<StructNodeElem<T> *> *gstruct,int **pperm,int *pnb_vars,Vector<T> **peta_g,SpMatrix<bool> **pgroups,Vector<int> **pown_variables,Vector<int> **pN_own_variables) throw(const char *){
  int nb_vars;
  *pnb_vars = 0;
  if (! checkGroupTree<T>(gstruct,true,&nb_vars))
    throw("treeOfGroupStruct: bad input data");

最佳答案

查看msdn http://msdn.microsoft.com/en-us/library/sa28fef8.aspx .

总结,只需使用 pragma #pragma warning( disable : 4290 )

关于c++ - 我在代码中的几行中得到了这个 "warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24170106/

相关文章:

c++ - 在 2D vector 中移动行

c++ - "Error: type name is not allowed"消息在编辑器中但在编译期间没有

c++ - const 限定符和数组

c++ - 如何在 Visual C++ 非托管代码中编写用户定义的异常?

c# - 依赖于 Visual C++ 2013 运行时的 NuGet 包

templates - 无法从 FieldType* 推断出 T* 的模板参数(仅限 Visual C++)

c++ - 如何判断段错误?

c++ - 在 C++ 中验证 GPS 字符串的最简单方法?

c - cvMemStorage的结构?

c - Unicode 与多字节