How to properly configure MSVC's compiler options with QtCreator?

a 夏天 提交于 2019-12-11 10:06:00

问题


I'm trying to migrate from Visual Studio 2008 to QtCreator in a project that uses C++/CLI extensions. This just means that I need to use the -clr compiler option when compiling my files.

I've managed to add it by adding the following line to my project.pro file:

QMAKE_CXXFLAGS += -clr

However, there is a conflicting option in my compiler's call that is conflicting with this one. It is the -EHsc option. But I can't find where these options get included and how to disable it. My default call to the compiler is looking like this:

cl -c -nologo -Zm200 -Zc:wchar_t- -clr -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"<PATH_TO_QT>\4.8.0\msvc2010\include\QtCore" -I"<PATH_TO_QT>\4.8.0\msvc2010\include\QtGui" -I"<PATH_TO_QT>\4.8.0\msvc2010\include" -I"<PATH_TO_QT>\4.8.0\msvc2010\include\ActiveQt" -I"debug" -I"." -I"..\MyProject" -I"." -I"<PATH_TO_QT>\4.8.0\msvc2010\mkspecs\win32-msvc2010" -Fodebug\ @<SOME_TEMP_FILE>.jom

Any ideas on how to achieve what I want here?


回答1:


I've found the problem. It was in another qmake's environment variable. The solution was this:

QMAKE_CXXFLAGS += -clr
QMAKE_CXXFLAGS_STL_ON -= -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_ON -= -EHsc

I've got a lot of warnings in the Qt library but I will get into those later.



来源:https://stackoverflow.com/questions/9772651/how-to-properly-configure-msvcs-compiler-options-with-qtcreator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!