Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [solved]In Qt Creator, how to set project property for both MinGW and VC compiler?
Forum Updated to NodeBB v4.3 + New Features

[solved]In Qt Creator, how to set project property for both MinGW and VC compiler?

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 5 Posters 9.1k 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.
  • K Offline
    K Offline
    kathy
    wrote on 29 Jun 2011, 20:11 last edited by
    #1

    I know how to use MinGW or Visual C++ compiler for Qt Application on Windows. But I would like some way to auto select the pro setting.

    For example:

    inside my pro file, I need to set boost lib:

    for minGW

    LIBS += C:/MinGW/boost_1_46_1/lib/libboost_thread.a
    LIBS += C:/MinGW/boost_1_46_1/lib/libboost_date_time.a

    for VC++

    LIBS += C:/VC++/boost_1_46_1/lib/libboost_thread-vc90-mt-1_46_1.lib
    LIBS += C:/VC++/boost_1_46_1/lib/libboost_date_time-vc90-mt-1_46_1.lib

    How to change the pro file so that I do not need manually comment out the LIBS for different compiler?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Duck
      wrote on 29 Jun 2011, 20:41 last edited by
      #2

      You can use scopes, like

      win32-g++ {
      LIBS += C:/MinGW/boost_1_46_1/lib/libboost_thread.a
      LIBS += C:/MinGW/boost_1_46_1/lib/libboost_date_time.a
      }
      win32-msvc*{
      LIBS = C:/VC+/boost_1_46_1/lib/libboost_thread-vc90-mt-1_46_1.lib
      LIBS = C:/VC+/boost_1_46_1/lib/libboost_date_time-vc90-mt-1_46_1.lib
      }

      1 Reply Last reply
      2
      • T Offline
        T Offline
        tobias.hunger
        wrote on 30 Jun 2011, 06:53 last edited by
        #3

        I actually hate to hardcode pathes like those into the build system: This will break as soon as you hand it over to somebody else!

        Maybe you could use environment variables or something instead. Those are a bit easier to change and document (set BLAH to "/some/path" instead of edit "blah.pro", search for the line reading LIBS += "/some/path" and replace it with the path you need.

        Unfortunately qmake does not support proper configuration steps to do the whole configuration properly.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on 30 Jun 2011, 07:44 last edited by
          #4

          Maybe we can write like this:

          @
          OPENCVPATH_MSVC = D:/Qt/OpenCV-2.1.0-vs2008
          OPENCVPATH_MINGW = D:/Qt/OpenCV-2.1.0-mingw

          win32-msvc*{
          INCLUDEPATH += $${OPENCVPATH_MSVC}/include
          CONFIG(debug, debug|release) {
          LIBS+=-L$${OPENCVPATH_MSVC}/lib/
          -lcxcore210d
          -lhighgui210d
          } else {
          LIBS += -L$${OPENCVPATH_MSVC}/lib/
          -lcxcore210
          -lhighgui210
          }
          }

          win32-g++{
          INCLUDEPATH += $${OPENCVPATH_MINGW}/include
          LIBS += -L$${OPENCVPATH_MINGW}/lib
          -lcxcore210
          -lhighgui210
          }

          unix:LIBS += -lcv
          -lhighgui
          @

          1 Reply Last reply
          0
          • I Offline
            I Offline
            ibingow
            wrote on 21 Jul 2011, 16:35 last edited by
            #5

            LIBS += -LC:/MinGW/boost_1_46_1/lib/
            win32-g++ {
            LIBS += -lboost_thread -lboost_date_time
            } else: win32-msvc* {
            LIBS += -lboost_thread-vc90-mt-1_46_1 -lboost_date_time-vc90-mt-1_46_1
            }

            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