关于qtcreator无法编译, make命令可以编译的问题

众里寻佳千百度1995 2019-05-06 05:20:34
交叉编译工具已经安装配置路径如图:



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编译就会出错,是什么原因。



...全文
2314 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 3 楼 弓人水的回复:
一看报错,就知道交叉编译环境变量没有配置。
Yocto交叉编译环境,配置到Qt Creator里面,有两种方法:
第一种:简单点做法,在命令行,先souce environment-setup-*****,然后再命令行执行启动Qt
Creator的命令;
第二种:稍微复杂一些,就是通过env命令打印上面的的所有环境变量,然后拷贝这些环境变量到Qt配置的Kits中的environment选项中。

我看了下,你的是Qt 5.3.2的Creator不清楚environment的具体位置,如果没有的话,可以安装一个稍微高些的版本Creator,我的是Qt5.8。
问题解决,的确是环境变量的问题。
浮一大白开水 2019-06-06
  • 打赏
  • 举报
回复
如果qt始终有一些编译、配置上面的问题,而又不知道如何解决时,建议将qt重新安装,或安装更新版本。再重新配置环境,这样可能会更快的解决问题,因为有时自已都忘记修改了哪些地方,导致始终无法正常使用。反正我是有几次是这样,弄了半天,重新安装,重新配置就正常了。。。
弓人水 2019-06-05
  • 打赏
  • 举报
回复
一看报错,就知道交叉编译环境变量没有配置。
Yocto交叉编译环境,配置到Qt Creator里面,有两种方法:
第一种:简单点做法,在命令行,先souce environment-setup-*****,然后再命令行执行启动Qt
Creator的命令;
第二种:稍微复杂一些,就是通过env命令打印上面的的所有环境变量,然后拷贝这些环境变量到Qt配置的Kits中的environment选项中。

我看了下,你的是Qt 5.3.2的Creator不清楚environment的具体位置,如果没有的话,可以安装一个稍微高些的版本Creator,我的是Qt5.8。
donwmufromdying 2019-06-05
  • 打赏
  • 举报
回复
你的编译器应该是g++啊,你怎么变成c了,实在不行直接修改Makefile文件把编译器命令修改成可用的,比如:g++ 一般对应的Makefile中的变量 $(MAKE)
zarelaky 2019-06-04
  • 打赏
  • 举报
回复
complier里面添加一个c++的编译器,你填的是c的

16,798

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧