交叉編譯工具已經安裝配置路徑如圖:



Build—>run qmake 沒有問題:
15:00:31: Running steps for project untitled_new1...
15:00:31: Starting: "/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake" /mnt/hgfs/qt_vmshare/untitled_new1/untitled_new1.pro -r -spec linux-oe-g++ CONFIG+=debug
15:00:32: The process "/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake" exited normally.
15:00:32: Elapsed time: 00:01.
Build—> Buildall 編譯出錯:
15:05:43: Running steps for project untitled_new1...
15:05:43: Configuration unchanged, skipping qmake step.
15:05:43: Starting: "/usr/bin/make"
c -pipe -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ -I. -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -o main.o main.cpp
make: c: Command not found
Makefile:709: recipe for target 'main.o' failed
c -pipe -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ -I. -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -o widget.o widget.cpp
Makefile:845: recipe for target 'widget.o' failed
make: [main.o] Error 127 (ignored)
make: c: Command not found
make: [widget.o] Error 127 (ignored)
c -pipe -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ -I. -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -I/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -o moc_widget.o moc_widget.cpp
Makefile:848: recipe for target 'moc_widget.o' failed
o untitled_new1 main.o widget.o moc_widget.o -L/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lEGL -lGAL -lpthread
Makefile:202: recipe for target 'untitled_new1' failed
make: c: Command not found
make: [moc_widget.o] Error 127 (ignored)
make: o: Command not found
make: [untitled_new1] Error 127 (ignored)
15:05:43: The process "/usr/bin/make" exited normally.
15:05:43: Elapsed time: 00:00.
如果在工程目錄使用:make命令編譯程式。也是沒有問題的,可以生產可執行檔案。
使用qtcreator編譯就會出錯,是什么原因。
uj5u.com熱心網友回復:
complier里面添加一個c++的編譯器,你填的是c的uj5u.com熱心網友回復:
你的編譯器應該是g++啊,你怎么變成c了,實在不行直接修改Makefile檔案把編譯器命令修改成可用的,比如:g++一般對應的Makefile中的變數 $(MAKE)
uj5u.com熱心網友回復:
一看報錯,就知道交叉編譯環境變數沒有配置。Yocto交叉編譯環境,配置到Qt Creator里面,有兩種方法:
第一種:簡單點做法,在命令列,先souce environment-setup-*****,然后再命令列執行啟動Qt
Creator的命令;
第二種:稍微復雜一些,就是通過env命令列印上面的的所有環境變數,然后拷貝這些環境變數到Qt配置的Kits中的environment選項中。
我看了下,你的是Qt 5.3.2的Creator不清楚environment的具體位置,如果沒有的話,可以安裝一個稍微高些的版本Creator,我的是Qt5.8。
uj5u.com熱心網友回復:
如果qt始終有一些編譯、配置上面的問題,而又不知道如何解決時,建議將qt重新安裝,或安裝更新版本。再重新配置環境,這樣可能會更快的解決問題,因為有時自已都忘記修改了哪些地方,導致始終無法正常使用。反正我是有幾次是這樣,弄了半天,重新安裝,重新配置就正常了。。。uj5u.com熱心網友回復:
問題解決,的確是環境變數的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/143051.html
標籤:Qt
