Results 1 to 5 of 5

Thread: Adding -O3 compiler option in Qt Creator

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Adding -O3 compiler option in Qt Creator

    Hello!

    I'm using MinGW and GCC for my Qt projects and I want to add the compiler option -O3 to optimize my code. I thought that the place to add compiler options was in Projects->Make->Make arguments, where I successfully already added the -j compiler option, but this time it doesn't work no matter how I try to insert -O3 there.

    Should I put it in another place? And if not, how exactly to do it?


    Thanks,

    Momergil
    May the Lord be with you. Always.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Adding -O3 compiler option in Qt Creator

    You should be able to do it via .pro file:
    Qt Code:
    1. QMAKE_CXXFLAGS += -O3
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to stampede for this useful post:

    Momergil (26th June 2014)

  4. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Adding -O3 compiler option in Qt Creator

    Quote Originally Posted by stampede View Post
    You should be able to do it via .pro file:
    Qt Code:
    1. QMAKE_CXXFLAGS += -O3
    To copy to clipboard, switch view to plain text mode 
    Thanks stampede for the reply. Although I'm not sure it's working, at least now it's not giving me any compiler errors!!


    Momergil
    May the Lord be with you. Always.

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Adding -O3 compiler option in Qt Creator

    You can always check the command used to invoke the compiler, eg
    Qt Code:
    1. g++ -c -O3 -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPO
    2. RT -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNO
    3. W -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I'../../../
    4. ../Qt/include/QtCore' -I'../../../../Qt/include/QtGui' -I'../../../../Qt/include
    5. /QtSql' -I'../../../../Qt/include' -I'.' -I'../../../../Qt/include/ActiveQt' -I'
    6. debug' -I'../../../../Qt/mkspecs/default' -o debug/main.o main.cpp
    To copy to clipboard, switch view to plain text mode 
    You can see the -O3 flag added to compiler options.
    Btw. it worked with the -j switch, because -j is the make command option, whereas "-O3" is the compiler option.

  6. The following user says thank you to stampede for this useful post:

    Momergil (28th June 2014)

  7. #5
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Adding -O3 compiler option in Qt Creator

    Thanks for the tip and for the explanation!


    Momergil
    May the Lord be with you. Always.

Similar Threads

  1. Replies: 2
    Last Post: 11th March 2014, 12:02
  2. how to add C++ compiler to QT creator?
    By costa in forum Qt Tools
    Replies: 3
    Last Post: 25th February 2014, 15:44
  3. Compiler Option /Zc:wchar_t
    By Vivi in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2013, 00:43
  4. Replies: 7
    Last Post: 26th October 2012, 22:18
  5. Unable to open Help option in Qt creator.
    By Channareddy in forum Qt Tools
    Replies: 2
    Last Post: 22nd July 2011, 10:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.