如何启用例外处理的MinGW [英] How to enable exception handling in mingw

查看:361
本文介绍了如何启用例外处理的MinGW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来MinGW和C ++编程。我试图建立一个C ++项目,但得到下面的错误。


  

错误:异常处理禁用,使用-fexceptions启用


在哪里我需要通过这个-fexceptions参数。当我试图


  

的mingw32-使-fexceptions


我收到follwoing错误。


  

的mingw32-化妆:异常:没有这样的文件或目录



解决方案

由于您使用Qt的,在您的项目文件中添加例外的CONFIG变量(* .pro文件):

  CONFIG + =异常

这应该通过正确的编译器标志的照顾。

在任何情况下,不要修改生成的Makefile。随着Qt的qmake的,Makefile文件仅仅是一个自动生成的文件。

I am new to Mingw and C++ programming. I am trying to build a C++ project but getting following error.

error: exception handling disabled, use -fexceptions to enable.

Where I need to pass this -fexceptions parameter. When I am trying

mingw32-make -fexceptions

I am getting follwoing error.

mingw32-make: exceptions: No such file or directory

解决方案

Since you're using Qt, add "exceptions" to the CONFIG variable in your project file (the *.pro file):

CONFIG += exceptions

This should take care of passing the correct compiler flags.

In any event, do not modify the generated Makefile. With Qt's qmake, the Makefile is just an auto-generated file.

这篇关于如何启用例外处理的MinGW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆