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. Compiler Options [Solved]
Forum Updated to NodeBB v4.3 + New Features

Compiler Options [Solved]

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 3.3k 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.
  • N Offline
    N Offline
    nickninevah
    wrote on last edited by
    #1

    Hi all.

    I am trying to pass options to the compiler in Qt Creator. I'm new to Qt. Please take pity and explain why when I pass options to the compiler in creator, my program won't compile. But if I use the compiler directly via the command line with options, everything goes fine.

    OS: OpenSUSE Linux 12.3 (64 bit)
    Compiler: g++
    QT: 4.8.4 (64 bit)
    Creator: 2.6.2

    I passed options to the compiler with the following entries in my .pro file.

    @QMAKE_CXXFLAGS += -O2
    QMAKE_CXXFLAGS += -llapack
    QMAKE_CXXFLAGS += -lblas@

    I tried running this directly on the command line.

    @g++ -O2 -llapack -lblas main.cpp@

    Works just fine.

    But in Qt Creator, doesn't work. I checked my compile output, and I can see that the options are included.

    @10:06:31: Running steps for project testArma1...
    10:06:31: Starting: "/usr/bin/qmake" /home/nicholas/Development/testArma1/testArma1.pro -r -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug
    10:06:31: The process "/usr/bin/qmake" exited normally.
    10:06:31: Starting: "/usr/bin/make" -w
    make: Entering directory /home/nicholas/Development/testArma1-build-Desktop-Debug' g++ -c -m64 -pipe -O2 -llapack -lblas -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I../testArma1 -I/usr/include/QtCore -I/usr/include -I. -I../testArma1 -I. -o main.o ../testArma1/main.cpp ../testArma1/main.cpp:8:5: warning: unused parameter 'argc' [-Wunused-parameter] ../testArma1/main.cpp:8:5: warning: unused parameter 'argv' [-Wunused-parameter] g++ -m64 -o testArma1 main.o -L/usr/lib64 -lQtCore -L/usr/lib64 -lpthread main.o: In function gemv<double>':
    /usr/include/armadillo_bits/blas_wrapper.hpp:39: undefined reference to dgemv_' main.o: In function gemm<double>':
    /usr/include/armadillo_bits/blas_wrapper.hpp:74: undefined reference to dgemm_' main.o: In function gemv<double>':
    /usr/include/armadillo_bits/blas_wrapper.hpp:39: undefined reference to dgemv_' main.o: In function dot<double>':
    /usr/include/armadillo_bits/blas_wrapper.hpp:140: undefined reference to ddot_' collect2: error: ld returned 1 exit status make: Leaving directory /home/nicholas/Development/testArma1-build-Desktop-Debug'
    make: *** [testArma1] Error 1
    10:06:38: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project testArma1 (kit: Desktop)
    When executing step 'Make'@

    I even tried using the exact Qt command in the command line, minus the Qt variables.

    @g++ -c -m64 -pipe -O2 -llapack -lblas -g -Wall -W -I/usr/share/qt4/mkspecs/linux-g++-64 -I../testArma1 -I/usr/include/QtCore -I/usr/include -I. -I../testArma1 -I. -o main.o ../testArma1/main.cpp@

    And that worked fine. I assume something important is happening in the Qt variables. But I'm too new at this to know what. Any help please?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Your options are passed but they are wrong (except for the O2).

      -llapack and -lblas are linker options and since these are "libraries" options what you need to do is:

      @LIBS += -llapack -lblas@

      in your pro file and you should be good

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nickninevah
        wrote on last edited by
        #3

        You were right. Worked perfect once I added those as libs. Thanks!

        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