【问题标题】:How do I resolve error MSB6006: "cmd.exe" exited with code 3?如何解决错误 MSB6006:“cmd.exe”以代码 3 退出?
【发布时间】:2015-03-19 23:14:28
【问题描述】:

我在构建代码时遇到以下错误:

C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error      
MSB6006: "cmd.exe" exited with code 3.
Done executing task "CustomBuild" -- FAILED. (TaskId:40)

我该如何解决这个问题?

【问题讨论】:

  • 我们需要查看更多您的自定义构建代码。从您向我们展示的非常少的内容来看,您似乎正在尝试在某个文件(头文件、文本文件、protobuf ......等?)上执行自定义构建,但是文件的路径不正确,因此为什么使用 cmd .exe 退出。

标签: c++ visual-studio building custom-build-step custom-build


【解决方案1】:
 <QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
  </PropertyGroup>
  <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
    <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
  </Target>

////////////////

 <CustomBuild Include="temp\moc\moc_predefs.h.cbt">
      <FileType>Document</FileType>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\QTINSTALL\5.9.3\5.9.3\MSVC2015\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ..\..\..\..\QTINSTALL\5.9.3\5.9.3\MSVC2015\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;temp\moc\moc_predefs.h</Command>
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generate moc_predefs.h</Message>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">temp\moc\moc_predefs.h;%(Outputs)</Outputs>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\QTINSTALL\5.9.3\5.9.3\MSVC2015\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ..\..\..\..\QTINSTALL\5.9.3\5.9.3\MSVC2015\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;temp\moc\moc_predefs.h</Command>
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generate moc_predefs.h</Message>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">temp\moc\moc_predefs.h;%(Outputs)</Outputs>
    </CustomBuild>

我也有同样的问题。这是我的一些自定义构建,我刚刚从另一台计算机复制了一个项目,我已经设置了 Qt vs 工具和 vs 的附加 lib\include,它仍然无法正常工作。

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

将您的 .vcxproj 文件作为 .xml 文件打开(使用 Notepad++ 或等效文件也是如此。)

您应该能够在文件中搜索“CustomBuild”标签。

该标签定义的任务中的某些内容失败了。

您可以通过尝试从与 .vcxproj 相同目录中的命令行运行该任务中的命令来测试它是什么。

如果您无法从那里解决问题,我建议您将“CustomBuild”任务添加到问题中,以便我们更好地帮助您。

【讨论】:

    猜你喜欢
    • 2013-02-28
    • 1970-01-01
    • 2012-03-01
    • 2012-10-18
    • 1970-01-01
    • 2014-04-28
    • 1970-01-01
    • 2020-06-19
    • 1970-01-01
    相关资源
    最近更新 更多