[SOLVED] Problem compiling with Qt Creator



  • 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 directoryC:/Users/zorgy/Dropbox/Qt Projects/Rabin'
    mingw32-make: *** [debug] Error 2



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



  • 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?



  • 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!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.