When I create a QtWidget application using QtCreator, and have exactly the same code. I can build and run it fine.
So it seems that the problem is with qmake when I try to compile it from the terminal.
If I create a project file called hello.pro using QtCreator, and have the file hello.cpp with the above code, if I build it using qmake, make (instead of QtCreator) it gives a segmentation fault.
But if I build it in QtCreator it will work fine.
Does anyone know why this may be occurring? Are there options that need to be specified to qmake or make?
Added after 16 minutes:
Hi, I found the solution to the problem.
In my .bashrc I had the PATH variable as:
export PATH=$PATH:/opt/QtSDK/Desktop/Qt/474/gcc/bin:/opt/QtSDK/QtCreator/bin
instead of
export PATH=/opt/QtSDK/Desktop/Qt/474/gcc/bin:/opt/QtSDK/QtCreator/bin:$PATH
so it was using the version of qmake in /usr/bin which was for Qt 4.3.4
instead of the version in
/opt/QtSDK/Desktop/Qt/474/gcc/bin
which was for version Qt 4.7.4.
Once I changed it around, it accessed the right version of qmake, and worked fine.
Bookmarks