到目前为止,我已经在命令行中使用qmake -project
和qmake
来完成.pro文件Makefile.Debug和Makefile.Release的配置。但是,当我尝试在命令行中使用mingw32-make
为项目生成.exe时,就会发生错误。
错误暗示该行:
64 ****missing separator ...Stop
但是在这种情况下,我已经为mingw32-make.exe
和qmake.exe
设置了所有环境变量。
有人说我应该在发生错误的位置(错误位置只有一个“ <<”)在makefile.release中添加一个Tab而不是空格,但是当我进行更改时会发生其他错误。而且我认为,由于Makefile都是由qmake
命令自动生成的,所以也许这不是真正的问题...
这是错误信息以及Makefile.Release文件的一部分,以供参考
:
Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!
D:\qt5.10\5.9.2\msvc2017_64>cd D:\qtProgramme\helloworld
D:\qtProgramme\helloworld>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'D:/qtProgramme/helloworld'
Makefile.Release:64: *** missing separator. Stop.
mingw32-make[1]: Leaving directory 'D:/qtProgramme/helloworld'
Makefile:36: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
D:\qtProgramme\helloworld>
这是Makefile。发布:
#############################################################################
# Makefile for building: helloworld
# Generated by qmake (3.1) (Qt 5.9.2)
# Project: helloworld.pro
# Template: app
#############################################################################
MAKEFILE = Makefile.Release
####### Compiler, tools and options
CC = cl
CXX = cl
DEFINES = -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG
CFLAGS = -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 $(DEFINES)
CXXFLAGS = -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc $(DEFINES)
INCPATH = -I. -I. -I..\..\qt5.10\5.9.2\msvc2017_64\include -I..\..\qt5.10\5.9.2\msvc2017_64\include\QtWidgets -I..\..\qt5.10\5.9.2\msvc2017_64\include\QtGui -I..\..\qt5.10\5.9.2\msvc2017_64\include\QtANGLE -I..\..\qt5.10\5.9.2\msvc2017_64\include\QtCore -Irelease -I..\..\qt5.10\5.9.2\msvc2017_64\mkspecs\win32-msvc
LINKER = link
LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"
LIBS = /LIBPATH:D:\qt5.10\5.9.2\msvc2017_64\lib D:\qt5.10\5.9.2\msvc2017_64\lib\qtmain.lib /LIBPATH:C:\utils\my_sql\my_sql\lib /LIBPATH:C:\utils\postgresql\pgsql\lib shell32.lib D:\qt5.10\5.9.2\msvc2017_64\lib\Qt5Widgets.lib D:\qt5.10\5.9.2\msvc2017_64\lib\Qt5Gui.lib D:\qt5.10\5.9.2\msvc2017_64\lib\Qt5Core.lib
QMAKE = D:\qt5.10\5.9.2\msvc2017_64\bin\qmake.exe
IDC = idc
IDL = midl /NOLOGO
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
SED = $(QMAKE) -install sed
COPY_FILE = copy /y
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = copy /y
INSTALL_PROGRAM = copy /y
INSTALL_DIR = xcopy /s /q /y /i
QINSTALL = D:\qt5.10\5.9.2\msvc2017_64\bin\qmake.exe -install qinstall
QINSTALL_PROGRAM = D:\qt5.10\5.9.2\msvc2017_64\bin\qmake.exe -install qinstall -exe
####### Output directory
OBJECTS_DIR = release
####### Files
SOURCES = main.cpp
OBJECTS = release\main.obj
DIST = main.cpp
QMAKE_TARGET = helloworld
DESTDIR = release\ #avoid trailing-slash linebreak
TARGET = helloworld.exe
DESTDIR_TARGET = release\helloworld.exe
####### Implicit rules
.SUFFIXES: .c .cpp .cc .cxx
{.}.cpp{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
$<
<<
{.}.cc{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
$<
<<
{.}.cxx{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
$<
<<
{.}.c{release\}.obj::
$(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ @<<
$<
<<
####### Build rules
first: all
all: Makefile.Release $(DESTDIR_TARGET)
$(DESTDIR_TARGET): $(OBJECTS)
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<<
release\main.obj
$(LIBS)
<<
qmake: FORCE
@$(QMAKE) -o Makefile.Release helloworld.pro
qmake_all: FORCE
答案 0 :(得分:1)
您正在使用Qt的MSVC版本。可以通过安装路径(D:\ qt5.10 \ 5.9.2 \ msvc2017_64)和输出“记住要调用vcvarsall.bat完成环境设置!”来推论得出。
从Qt的MSVC版本生成的QMake生成与MSVC兼容的makefile(至少默认情况下)。
安装Qt的MinGW版本,您就可以在项目中使用MinGW工具链。