c++ - Error using Qt 5.1.1 in code::blocks -
i trying combine code::blocks ide , qt 5.1.1 on win7 32bit. in cb use mingw's g++ compiler supports c++0x.
downloaded "qt-windows-opensource-5.1.1-mingw48_opengl-x86-offline.exe" , installed @ "d:\qt-library\5.1.1\mingw48_32\".
then in cb added 3 tools named "qmake -project" , "qmake" , "make" @ tools->configure tools->add.
"qmake -project" executable "d:\qt-library\5.1.1\mingw48_32\bin\qmake.exe", parameters: "-project -platform win32-g++"
"qmake" excutable same "qmake -project", no parameter;
"make" excutable "d:\qt-library\tools\mingw48_32\bin\mingw32-make.exe", no parameter
working directory set "${project_dir}"
and clicked project->properties, selected "this custom makefile"
then clickd "qmake -project" menu item in tools menu created above, qmake generated .pro file.
because use
#include <qapplication> instead of
#include <qtgui/qapplication> in main.cpp file added "qt += widgets" in .pro file.
click "qmake" in tools menu, makefiles generated. if directly make, won't compile, because doesn't support c++11 grammars,
edited makefile.debug , makefile.release, looks like:
cc = gcc cxx = g++ defines = -dunicode -dqt_no_debug -dqt_widgets_lib -dqt_gui_lib -dqt_core_lib -dqt_needs_qmain cflags = -pipe -fno-keep-inline-dllexport -o2 -wall -wextra $(defines) cxxflags = -pipe -fno-keep-inline-dllexport -o2 -frtti -wall -wextra -fexceptions -mthreads $(defines) i added -std=c++0x @ line cxxflags, become
cxxflags = -pipe -std=c++0x -fno-keep-inline-dllexport -o2 -frtti -wall -wextra -fexceptions -mthreads $(defines) (it won't work version of mingw if use -std=c++11)
then click "make" in tools menu, 2 errors:

i don't know hell how modified main function int main(int argc, char** argv) int qmain(int argc, char** argv). make again, 2 qmain error disappeared got this: 
and now, didn't thing, make again, error disappeared !!! generated .exe file won't anything, either double click or run in command line, nothing happen (by way, although included , didn't write qt code) if remove
#include <qapplication> and build project in normal way(cancel "this custom makefile" , build directly), program goes well.
another thing weird, added config += debug , config -= release in .pro file, qmake generate both makefile.debug , makefile.release(whatever config or debug , release uper or lower case), generated .o files , .exe files in release directory, no debug file, why ?
anyone has ideas ? i'll thankful suggestions.
the problem solved(although not perfectly).
the fact program did something, somehow no console window appear(before add qt header, wrote program in c++ , use cout print messages), no output can seen, if run program in console. found writing simple qt gui program print results, works. don't know reason why console wouldn't appear qapplication included no qt code in program (whatever set project->properties->build targets->select build target options->type gui or console).
on other hand, can run qt gui program double clicking .exe file in debug directory, not in code::blocks, pops "cannot locate program entry interlockedcompareexchange@12 on dynamic link library libstdc++-6.dll". can't debug program through cb.
Comments
Post a Comment