How to use c++11 and boost in qt creator(boost library and qt library together in qt creator)?
-
For C++11, add this to your qmake file:
@
CXXFLAGS+="c++0x"
@AFAIK, this is GCC flag, you might need to check if it works for other compilers, too.
As for boost, just add headers to INCLUDEPATH, and libraries to LIBS variables in qmake, and it should work.
-
Sorry, I should have typed more clearly. I meant the .pro file that you have in your project (if you use qmake. For cmake it's different). This file is parsed by qmake when you build your project.
-
Ah, I'm living in the past :P Even though I'm using GCC 4.7.
-
thank u all a lot....
but i have another question...
i apologize from you all.
that i have another problem...
when i installing Qt libraries 4.8.2 for Windows (minGW 4.4, 318 MB) it says to me its need mingw 4.4 ..but i have mingw 4.7 ...when i choose the mingw4.7 it says to me that only version with w32api3.13 are supported ...
how ever i instaled it and set the c:\mingw\bin in enviromentvariable....and do what you said ....
but my simple code event dosent correctly work.....:
.pro:
@
#-------------------------------------------------Project created by QtCreator 2012-09-04T17:51:47
#-------------------------------------------------
#//QMAKE_CXXFLAGS +=-std=c++0x
QMAKE_CXXFLAGS += -std=c++11
QT += coreQT -= gui
TARGET = lllming
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
/////////////////////////////////////
@
main.cpp:
@
#include <QCoreApplication>
#include<thread>
#include<iostream>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout<<"hello";
return a.exec();
}
/////////////////////////////////////////////////
@
program is gonna run but it crashed.....where is the mistake or do i have to set mingw in tool chain?(its auto detected,but i think it use vs2010 compiler as default ....
[Edit: Added @ tags around code. Please use proper formatting. -- mlong]
-
Sadly, getting a proper mingw and setting it up correctly is a very painful process. If you have access to MSVC, use it, will be easier and less frustrating. If you really need mingw, the easiest option is to install the Nokia Qt SDK, wich provides it's own mingw copy that is known to work.
-
the msvc problem is ,it doesnt supprot c++11..and i want to use c++ 11...becuase c++ and boost have some thing better than qt library like thread in c++ 11 is much easy and use full than thread in qt(it is in qt very confusing and not good at all,,,)...
-
[quote author="friendchp" date="1346875161"]seriously?[/quote]Seriously. GCC 4.4 is not binary compatible with GCC 4.7. This is the reason you have different packages for MSVC2005, MSVC2008 and MSVC2010, as they aren't binary compatible as well.
[quote author="friendchp" date="1346875161"]i really dont know how to do that ... i download the qt-creator-2.5.1-src code from qt ...[/quote]You need to build Qt, not Qt Creator.
Building Qt isn't that difficult. Just grab the desired "mingw":http://sourceforge.net/projects/mingwbuilds/, "git":http://msysgit.github.com/ and "perl":http://www.activestate.com/activeperl package.
@git clone git://gitorious.org/qt/qt.git & cd qt
configure
mingw32-make
@ -
[quote author="Lukas Geyer" date="1346911052"]
@git clone git://gitorious.org/qt/qt.git & cd qt
configure
mingw32-make
@
[/quote]https://bugreports.qt-project.org/browse/QTSDK-1166
Step #2 is a little different for MinGW/MSYS, actually. Make sure you call 'configure.exe', not 'configure' (they're different files) -
i installed the activeperl ,msisgit
and download the mingw( from where u told me)...
i typed git clone git://gitorious.org/qt/qt.git & cd qt
in git-cmd.bat....
and it doing this right now:C:\Users\FriendChp>git clone git://gitorious.org/qt/qt.git & cd qt
Cloning into 'qt'...
remote: Counting objects: 666833, done.
remote: Compressing objects: 100% (150956/150956), done.
Receiving objects: 3% (24271/666833), 6.68 MiB | 25 KiB/s..............................
am i right in this scope?
do i have to copy mingw( that i downloaded )in mingw folder in msysgit directory(before type those instruction in git-cmd.bat) ?
tanx in adv;) -
thanx alot to u all for your guide.
finally i build it...
(soorry for this question)
and now ...how can i use it?...how to use this library ?its size is almost 6gig.
how to use it in qt creator?...my qt creator now using the vs compiler for compiling..how to change it?
(i set the qmake (in this builing the library) in qt....and for compile time it say an error :
Error while building/deploying project future (target: Desktop)
When executing step 'qmake')
plz help... -
There are lots of question in ur mind......
Please read carefully how to work with "MAKEFILE", it is very important for building any library/app.- configure
- make
- install
- clean or delete src
- setup environment according to insatllation
- use it