开发者

using qtcreator and qmake, but not including QT dependencies

开发者 https://www.devze.com 2023-03-28 19:36 出处:网络
I like the environment, especially as I got hit by the VS MSBuild bug. Basically, QT -= gui core # No qt is used

I like the environment, especially as I got hit by the VS MSBuild bug. Basically,

QT -= gui core # No qt is used

yet, when I try to compile, I get the following error:

c:\QtSDK\Desktop\Qt\4.7.3\mingw\lib\libqtmaind.a(qtmain_win.o):-1: In function `WinMain@16':
c:/ndk_buildrepos/qt-desktop/src/winmain/qtmain_win.cpp:103: undefined reference to `qWinMain(HINSTANCE__*, HINSTANCE__*, char*, int, int&, QVector<char*>&)'

And so forth. How do I tell qtcreator to compile this without all the QT auto-includes?

edit Here's the compile command:

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -开发者_高级运维DQT_LARGEFILE_SUPPORT -DDEBUG -DQT_DLL -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/QtSDK/Desktop/Qt/4.7.3/mingw/include' -I'../libs/windows/SDL_win/include' -I'.' -I'util' -I'../libs/sources/UnitTest++/src' -I'../libs/windows' -I'../libs/sources/SDL_ttf-2.0.10' -I'../libs/windows' -I'util' -I'../libs/windows' -I'c:/QtSDK/Desktop/Qt/4.7.3/mingw/include/ActiveQt' -I'debug' -I'c:/QtSDK/Desktop/Qt/4.7.3/mingw/mkspecs/default' -o debug/main.o main.cpp

How do I disable all those -DQT* definitions?


I agree, Qt Creator is one of the best IDE's I've used for any language.

To solve the problem, do the following:

In your project (.PRO) file, add:

CONFIG -= qt

If you are writing a non-graphical application, you will want to add the following as well:

CONFIG += console

QT Creator also has a console application template:

New project -> console application -> (enter project name)
0

精彩评论

暂无评论...
验证码 换一张
取 消