gpt4 book ai didi

c++ - 未为项目设置 OutputPath 属性(C++、空白新解决方案、VS2017)

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:42:04 25 4
gpt4 key购买 nike

它发生在一个复杂的解决方案中,但我可以在一个新的空解决方案中重现它。

我用 Debug模式、X86、诊断构建了它 ( ctrl+shift+B )。 enter image description here

1> Set Property: _InvalidConfigurationMessageText=The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Win32'. 1> Set Property: _InvalidConfigurationMessageText=The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Win32'. This error may also appear in some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

enter image description here
^ 我确保没有任何 References它声称。

这是我尝试过的。

首先,我的一部分.vcxproj ( link to the full file ) 看起来像这样:-

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
### I will insert something here ###
</PropertyGroup>
  1. 根据 a SO linkanother one , 我应该在 ### 处插入其中一行:-

    <OutputPath>$(Configuration)\$(Platform)\</OutputPath>
    <OutputPath>$(SolutionDir)$(Configuration)\</OutputPath>
    <OutputPath>bin\$(Platform)\</OutputPath>
  2. 同上,但在<ItemGroup Label="ProjectConfigurations">中添加

  3. 删除 Label="Configuration" .

  4. 根据 another SO link ,我也试过AnyCPUAny CPU (在更复杂的解决方案中进行了测试,但新的空解决方案没有。)。

  5. A Microsoft link指出Output Path用于 C# .在 C++ , 我必须使用 Output Directory .是OutDir .

    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
    <OutDir>$(Configuration)\$(Platform)\</OutDir>
  6. 执行上述操作,但在属性表中。

  7. 做上面的事情,还要卸载-重新加载项目,甚至重启VS2017。

在我尝试了所有组合之后,警告仍然存在。

程序可以正确编译运行,
但我认为这是在更大的解决方案中进行不必要的重新编译的原因。

问题: 如何解决警告/错误?

OutputPath控制台中的字词是可疑的。
我怀疑 VS 是否将我的解决方案识别为 C# . (甚至有可能吗?-我的测试项目有 std::cout )

由于某些原因,关于此错误的大多数 SO 问题都与 msbuildC# 有关或 .net ( another one ),不是 C++

回复

没有这样的Win32组合框中的选项,所以我创建了一个新的。
Configuration Manager > Active solution platform : <New...>

我还要确保设置正确 :- enter image description here

但是,我仍然收到相同的错误消息。

最佳答案

您的平台设置可疑 - x86,将其更改为 Win32。

更新:因此问题似乎与项目无关,而与 Visual Studio 安装有关 - 尝试修复/重新安装它。

关于c++ - 未为项目设置 OutputPath 属性(C++、空白新解决方案、VS2017),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47923063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com