Solved Qt Program failing through commands in terminal
-
Hello,
i have ** Qt 5.7 ** installed in my ubuntu,
- If i use Qt creator and then build , then program compiles and i can run my executable.
- so if i try to build my program using commands , i will get error.
The following error is when using commands
these are the following errrors.
a) when i use qmake SampleProgram.pro , it is taking from
/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=softfp -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/local/Qt-5.4.0/mkspecs/devices/linux-imx6-g++ -I../../SampleMake -I../../SampleMake -I/u01/rootfs/usr/local/Qt-5.4.0/include -I/u01/rootfs/usr/local/Qt-5.4.0/include/QtWidgets -I/u01/rootfs/usr/local/Qt-5.4.0/include/QtGui -I/u01/rootfs/usr/local/Qt-5.4.0/include/QtCore -I. -I/u01/rootfs/usr/include -I. -o main.o ../main.cpp
b) when i use make - i am getting the following error.
bash: ./SampleMake: cannot execute binary file: Exec format error
the qmake its not taking from the installed Qt 5.7, please guide to run my program through commands also.
-
Just use absolute path to qmake you want to use instead of only qmake:
/path/to/qmake SampleProgram.pro
-
it worked,
the absolute path for generating the Make File.
But any solution how i can set it to take default qmake.
it is installed in the path :
/home/username/Qt5.7.0/5.7/gcc_64/bin/qmake -
@Pradeep-Kumar Well, you can add /home/username/Qt5.7.0/5.7/gcc_64/bin to PATH (at the beginning) but you really should not do that!
You could write a small script where you set an alias:#!/bin/sh alias qmake=/home/username/Qt5.7.0/5.7/gcc_64/bin/qmake
Make the script executable and execute it in the terminal where you want to build.
-
@Pradeep-Kumar said:
But any solution how i can set it to take default qmake.
it is installed in the path :
/home/username/Qt5.7.0/5.7/gcc_64/bin/qmakeYou can set a symlink in
/usr/local/bin/
:
sudo ln -s /home/username/Qt5.7.0/5.7/gcc_64/bin/qmake /usr/local/bin/qmake
(but that might be a problem if you have several users on that system because other users will see that symlink but can't access the qmake in your home directory).