用qmake和make编译Qt

时间:2013-07-18 07:39:36

标签: qt cmd makefile qmake

我需要有关使用cmd编译的Qt文件的帮助。我选择了目录,但我仍然有关于“qmake”和“make”命令的错误。

我不能qmake或make。我正在显示cmd目录。但是我无法编译它。我需要使用哪个目录???


C:\Users\foo>dir
 Volume in drive C has no label.
 Volume Serial Number is F224-008C

 Directory of C:\Users\foo

18.07.2013  09:42    <DIR>          .
18.07.2013  09:42    <DIR>          ..
17.07.2013  12:27    <DIR>          ipch
17.07.2013  16:41    <DIR>          QtTab
18.07.2013  09:42        21.450.752 QtTab.sdf
11.07.2013  11:17               882 QtTab.sln
11.07.2013  11:22    <DIR>          Win32
               2 File(s)     21.451.634 bytes
               5 Dir(s)  103.678.271.488 bytes free

C:\Users\foo>qmake
'qmake' is not recognized as an internal or external command,
operable program or batch file.


C:\Users\foo>make
'make' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\foo>cd qttab

C:\Users\foo>dir
 Volume in drive C has no label.
 Volume Serial Number is F224-008C

 Directory of C:\Users\foo

17.07.2013  16:41    <DIR>          .
17.07.2013  16:41    <DIR>          ..
17.07.2013  16:42    <DIR>          Debug
17.07.2013  16:41    <DIR>          GeneratedFiles
17.07.2013  16:41               308 main.cpp
11.07.2013  11:17               130 qttab.cpp
11.07.2013  11:17               254 qttab.h
11.07.2013  11:17                65 qttab.qrc
17.07.2013  16:41             1.353 qttab.ui
11.07.2013  11:17            10.830 QtTab.vcxproj
11.07.2013  11:17             2.659 QtTab.vcxproj.filters
11.07.2013  11:22               609 QtTab.vcxproj.user
11.07.2013  11:17    <DIR>          Resources
17.07.2013  12:28             1.994 foo.ui
               9 File(s)         18.202 bytes
               5 Dir(s)  103.678.271.488 bytes free

C:\Users\foo>qmake
'qmake' is not recognized as an internal or external command,
operable program or batch file.

2 个答案:

答案 0 :(得分:1)

由于您正在使用Windows,因此您似乎应该使用nmake,而不是make - 请参阅

qt documentation on compilation under windows

答案 1 :(得分:0)

扩展您的PATH系统变量以包含QT-InstallationDir / bin(这是qmake所在的位置)并在开始编译之前从cmd中的MSVC2010安装目录运行vcvars.bat文件(备用使用MSVC文件夹中startmenu中提供的cmd快捷方式