Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How to use c++11 and boost in qt creator(boost library and qt library together in qt creator)?
Forum Updated to NodeBB v4.3 + New Features

How to use c++11 and boost in qt creator(boost library and qt library together in qt creator)?

Scheduled Pinned Locked Moved C++ Gurus
21 Posts 6 Posters 26.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    friendchp
    wrote on last edited by
    #1

    Hello
    i want to use c++11 with qt library in qt creator...and i dont know how to use c++11 and boost library in qt creator.
    please some one tell me exactly how...
    ...
    tanx in adv;)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      1 Reply Last reply
      0
      • F Offline
        F Offline
        friendchp
        wrote on last edited by
        #3

        where is the qmake file?and how can i add something to it?
        i found a qmake fplder in my qt(instalation path),and it has alot of file to add(headers i think)...
        (im new in qt ,,and it was confusing me,,i need more help..plz help;)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Your qmake file is the .pro file. It can be accessed directly from the project tree in Qt Creator. The .pro file is the file describing your project.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            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.

            (Z(:^

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              @
              QMAKE_CXXFLAGS += -std=c++0x // for GCC < 4.7
              QMAKE_CXXFLAGS += -std=c++11 // for GCC >= 4.7
              @

              1 Reply Last reply
              1
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                Ah, I'm living in the past :P Even though I'm using GCC 4.7.

                (Z(:^

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  friendchp
                  wrote on last edited by
                  #8

                  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 += core

                  QT -= gui

                  TARGET = lllming
                  CONFIG += console
                  CONFIG -= app_bundle

                  TEMPLATE = 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]

                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    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.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      friendchp
                      wrote on last edited by
                      #10

                      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,,,)...

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lgeyer
                        wrote on last edited by
                        #11

                        [quote author="friendchp" date="1346838180"]when i choose the mingw4.7 it says to me that only version with w32api3.13 are supported ...[/quote]
                        You can't use a prebuilt Qt. You will have to build Qt on your own using GCC 4.7.

                        1 Reply Last reply
                        0
                        • F Offline
                          F Offline
                          friendchp
                          wrote on last edited by
                          #12

                          seriously?
                          i really dont know how to do that ...
                          i download the qt-creator-2.5.1-src code from qt ...
                          plz help me...
                          (tanx alot in adv to u all;) )

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            lgeyer
                            wrote on last edited by
                            #13

                            [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
                            @

                            1 Reply Last reply
                            0
                            • JKSHJ Online
                              JKSHJ Online
                              JKSH
                              Moderators
                              wrote on last edited by
                              #14

                              [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)

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                lgeyer
                                wrote on last edited by
                                #15

                                [quote author="JKSH" date="1346932867"]Step #2 is a little different for MinGW/MSYS, actually[/quote]
                                Not if you are building from the Windows command line.

                                1 Reply Last reply
                                0
                                • F Offline
                                  F Offline
                                  friendchp
                                  wrote on last edited by
                                  #16

                                  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;)

                                  1 Reply Last reply
                                  0
                                  • L Offline
                                    L Offline
                                    lgeyer
                                    wrote on last edited by
                                    #17

                                    Yes, as soon as git has finished cloning into qt.git you are ready to configure and build Qt.

                                    Just make sure mingw\bin and perl\bin is in %PATH%.

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      friendchp
                                      wrote on last edited by
                                      #18

                                      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...

                                      1 Reply Last reply
                                      0
                                      • P Offline
                                        P Offline
                                        pushpendrak
                                        wrote on last edited by
                                        #19

                                        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.

                                        1. configure
                                        2. make
                                        3. install
                                        4. clean or delete src
                                        5. setup environment according to insatllation
                                        6. use it

                                        PushpendraK

                                        1 Reply Last reply
                                        0
                                        • F Offline
                                          F Offline
                                          friendchp
                                          wrote on last edited by
                                          #20

                                          any help,please?

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved