How to change the C++ Runtime Library setting in QtCreator?

匿名 (未验证) 提交于 2019-12-03 08:35:02

问题:

I'm absolutely new to Qt. I've made a program using C++ in Visual Studio 2010 in which I use the external library from Dcmtk. I now want to add a user interface to that program. In my original program I had to change the C++ Runtime Library in Code Generation setting in Visual Studio to Multi-Threaded(/MT) from Multi-Threaded Debug DLL otherwise the program would not work. I have to do the same in QtCreator, but I don't know how to change that setting in Qt. Could you please suggest how I should approach that? Thanks.

回答1:

/MT is a compiler flag. You can specify flags in your .pro file like this:

QMAKE_CXXFLAGS += /MT

Moreover, you probably want to specify /MTd for debug build:

Release:QMAKE_CXXFLAGS += /MT Debug:QMAKE_CXXFLAGS += /MTd 


回答2:

In the version of QT 5.5 the variable is QMAKE_CXXFLAGS_DEBUG and QMAKE_CXXFLAGS_RELEASE so the new working solution for QT 5.5 is:

QMAKE_CXXFLAGS_DEBUG += /MTd QMAKE_CXXFLAGS_RELEASE += /MT 


回答3:

A qmake configuration is also available for this.

CONFIG += thread 


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