Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Problem compiling with Qt Creator
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Problem compiling with Qt Creator

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 6.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.
  • Z Offline
    Z Offline
    z0rgy
    wrote on last edited by
    #1

    Hi guys I am having trouble compiling a Qt application. The problem is simple but I dont know of a solution.
    QtCreator cant include correct include path, how can I make it do that?
    I get the error, file not found.
    I am compiling on windows 7

    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory C:/Users/zorgy/Dropbox/Qt Projects/Rabin' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I "c:\Qt\4.7.3\include\QtCore" -I"c:\Qt\4.7.3\include\QtGui" -I"c:\Qt\4.7.3\include" -I"." -I"c:\Qt\4.7.3\include\Act iveQt" -I"debug" -I"c:\Qt\4.7.3\mkspecs\win32-g++" -o debug\RabinBenchMark.o RabinBenchMark.cpp RabinBenchMark.cpp:2:31: error: QtCore/QElapseTimer: No such file or directory RabinBenchMark.cpp: In function 'int main(int, char**)': RabinBenchMark.cpp:32: error: 'QElapseTimer' was not declared in this scope RabinBenchMark.cpp:32: error: expected ';' before 'timer' RabinBenchMark.cpp:33: error: 'QFuture' was not declared in this scope RabinBenchMark.cpp:33: error: expected primary-expression before 'void' RabinBenchMark.cpp:33: error: expected ';' before 'void' RabinBenchMark.cpp:35: error: 'timer' was not declared in this scope RabinBenchMark.cpp: At global scope: RabinBenchMark.cpp:58: error: variable or field 'concurrentFunction' declared void RabinBenchMark.cpp:58: error: 'QElapseTimer' was not declared in this scope RabinBenchMark.cpp:58: error: 'timer' was not declared in this scope mingw32-make[1]: *** [debug/RabinBenchMark.o] Error 1 mingw32-make[1]: Leaving directory C:/Users/zorgy/Dropbox/Qt Projects/Rabin'
    mingw32-make: *** [debug] Error 2

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexisdm
      wrote on last edited by
      #2

      You apparently misspelled QElapsedTimer and you didn't include <QFuture>.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        z0rgy
        wrote on last edited by
        #3

        Thanks for your reply :) I managed to get on a bit further with the compilation.
        I now have the following error:

        RabinBenchMark.cpp: In function 'int main(int, char**)':
        RabinBenchMark.cpp:35: error: invalid use of void expression
        RabinBenchMark.cpp:35: warning: unused variable 'future'
        RabinBenchMark.cpp: In function 'void concurrentFunction(QElapsedTimer*)':
        RabinBenchMark.cpp:63: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'qint64'
        mingw32-make[1]: *** [debug/RabinBenchMark.o] Error 1

        I have this on line 35:
        @
        //What is wrong from this statement? I got it from the Qt API
        QFuture<void> future = QtConcurrent::run(concurrentFunction(&timer));

        // This is the function run in parallel
        void concurrentFunction(QElapsedTimer *timer) {
        if(getchar() == 'p') {
        print();
        printf("Time elapsed so far: %u miliseconds\n", timer->elapsed());
        }
        }
        @

        How can I solve the invalid use of void expression?

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          z0rgy
          wrote on last edited by
          #4

          Ah okay, I see my mistake,

          @
          //Wrong
          QFuture<void> future = QtConcurrent::run(concurrentFunction(&timer));
          //Right
          QFuture<void> future = QtConcurrent::run(concurrentFunction, &timer);
          @

          Thanks for your help!

          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