构建Qt应用程序时出错:/ bin / sh:-c:第1行:语法错误:意外的文件结束

时间:2020-11-26 22:47:15

I try to build my Qt application using these commands:

我尝试使用以下命令构建我的Qt应用程序:

qmake -recursive external.pro
make

But it fails with this error:

但它失败了这个错误:

/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [sub-bzip2-1-0-5-bzip2-1-0-5-pro-make_first] Error 2

Why am I getting this error, and how to fix it?

为什么我会收到此错误,以及如何解决此问题?

2 个解决方案

#1


1  

When you install Qt, make sure you take an installer windows for mingw (e.g qt-opensource-windows-x86-mingw482_opengl-5.3.0.exe) and during the installation, check if it detect your mingw installation (specially your make.exe binary). Qt need to patch your binary.

当您安装Qt时,请确保为mingw采用安装程序窗口(例如qt-opensource-windows-x86-mingw482_opengl-5.3.0.exe),并在安装过程中检查它是否检测到您的mingw安装(特别是您的make.exe)二进制)。 Qt需要修补你的二进制文件。

#2


0  

I had the same error, but in my case it was because I had added Cygwin's bin directory to PATH in Windows:

我有同样的错误,但在我的情况下,这是因为我在Windows中将Cygwin的bin目录添加到了PATH:

构建Qt应用程序时出错:/ bin / sh:-c:第1行:语法错误:意外的文件结束

Removing it fixed the error (you also need to restart Qt Creator so it refreshes its environment variables).

删除它修复了错误(您还需要重新启动Qt Creator,以便刷新其环境变量)。

#1


1  

When you install Qt, make sure you take an installer windows for mingw (e.g qt-opensource-windows-x86-mingw482_opengl-5.3.0.exe) and during the installation, check if it detect your mingw installation (specially your make.exe binary). Qt need to patch your binary.

当您安装Qt时,请确保为mingw采用安装程序窗口(例如qt-opensource-windows-x86-mingw482_opengl-5.3.0.exe),并在安装过程中检查它是否检测到您的mingw安装(特别是您的make.exe)二进制)。 Qt需要修补你的二进制文件。

#2


0  

I had the same error, but in my case it was because I had added Cygwin's bin directory to PATH in Windows:

我有同样的错误,但在我的情况下,这是因为我在Windows中将Cygwin的bin目录添加到了PATH:

构建Qt应用程序时出错:/ bin / sh:-c:第1行:语法错误:意外的文件结束

Removing it fixed the error (you also need to restart Qt Creator so it refreshes its environment variables).

删除它修复了错误(您还需要重新启动Qt Creator,以便刷新其环境变量)。