2

我被要求使用 msbuild 构建一个基于 qt 的解决方案文件。我尝试使用以下命令,但最终出现错误。我可以使用如下所示的相同命令构建一个 wix 项目。

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild "C:\path\to\my solution file\my.sln" /t:Build /p:Configuration=Release /p:Platform=Win32

有了这些,我收到一个错误消息,

C:\Program Files\MSBuild\Microsoft.CppCommon.targets(155,5):
error MSB6006: "cmd.exe" exited with code 3. [c:\my\path to\project file\my.vcxproj]

Moc'ing时系统未读取my.vcxproj中各种文件的路径。我收到以下错误

InitializeBuildStatus:
    Touching "Win32\Release\my.unsuccessfulbuild".
CustomBuild:
    Moc'ing "dialog.h"...
    The system cannot find the file path specified
    Moc'ing "Centralwidget.h"...
    The system cannot find the file path specified

等等....

我也尝试过使用 qmake 构建,但没有成功。期待有关使用哪种方法构建基于 qt 的解决方案文件的好建议。提前致谢

4

1 回答 1

2

使用 MSBuild 构建 Qt 解决方案文件,

def buildsolution(self,solutionpath):
    if not os.path.isfile(self.msbuild):
        raise Exception('MSBuild.exe not found. path=' + self.msbuild)
    arg1 = '/t:Rebuild'
    arg2 = '/p:Configuration=Release'
    arg3 = '/p:Platform=Win32'
    proc = subprocess.Popen(([self.msbuild,solutionpath,arg1,arg2,arg3]), shell=True, 
                    stdout=subprocess.PIPE) 
    while True:
        line = proc.stdout.readline()                        
        wx.Yield()
        if not line: break
    proc.wait() 

其中self.msbuild=r'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'solutionpath=r'path to\qt solution file\my.sln'

于 2013-04-03T04:21:31.177 回答