输出目录宏的Visual Studio相对路径似乎无法正常工作

时间:2023-01-15 00:02:56

I'm receiving the following build warning when attempting to compile a .sln for Chromium:

在尝试为Chromium编译.sln时,我收到以下构建警告:

Warning 1   warning MSB8012: TargetPath(C:\chromiumtrunk\chromium\src\base\allocator\..\..\build\Debug\allocator_extension_thunks.lib) does not match the Library's OutputFile property value (C:\chromiumtrunk\chromium\src\build\Debug\lib\allocator_extension_thunks.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets   1299    5   allocator_extension_thunks

It is complaining that this path:

它抱怨这条道路:

C:\chromiumtrunk\chromium\src\base\allocator\..\..\build\Debug\allocator_extension_thunks.lib

doesn't match the expected path:

与预期路径不匹配:

C:\chromiumtrunk\chromium\src\build\Debug\lib\allocator_extension_thunks.lib)

but... "\base\allocator..\..\" should cancel out... right? The only other difference between the two paths is the fact that the .lib gets output to a /lib folder. This seems correct. I don't understand how I should be properly resolving this message.

但是......“\ base \ allocator .. \ .. \”应该取消...对吗?两个路径之间唯一的另一个区别是.lib输出到/ lib文件夹。这似乎是正确的。我不明白我应该如何正确地解决这个消息。

I'm happy to provide any information necessary. I assume it's just a simple variable tweak, but a bit lost..

我很乐意提供所需的任何信息。我认为它只是一个简单的变量调整,但有点丢失..

C/C++ -> General -> Output Directory: '..\..\build\$(Configuration)\
C/C++ -> General -> Intemeradiate Directory: '$(OutDir)obj\$(ProjectName)\
Librarian -> General -> Output File: $(OutDir)lib\$(ProjectName).lib

1 个解决方案

#1


1  

Yes, the extra "lib" produces this warning, the two paths do not match. Not actually sure what goes wrong, the final .lib file does end up in the lib directory even though MSBuild reports it wrong in the build completion message. Short from that bad message, I'd guess at an issue with automatic dependencies. This friction got introduced at VS2010 when they moved from the custom VCBuild to MSBuild.

是的,额外的“lib”会产生此警告,两条路径不匹配。实际上并不确定会出现什么问题,最终的.lib文件最终会在lib目录中结束,即使MSBuild在构建完成消息中报告错误也是如此。从那个糟糕的消息中简而言之,我猜测自动依赖的问题。当它们从自定义VCBuild移动到MSBuild时,VS2010引入了这种摩擦。

If you want to get rid of the warning then restore the library project's Output File setting to $(OutDir)$(TargetName)$(TargetExt) and change the Output Directory to ..\..\build\lib\$(Configuration).

如果要删除警告,请将库项目的输出文件设置恢复为$(OutDir)$(TargetName)$(TargetExt),并将输出目录更改为.. \ .. \ build \ lib \ $(配置) 。

#1


1  

Yes, the extra "lib" produces this warning, the two paths do not match. Not actually sure what goes wrong, the final .lib file does end up in the lib directory even though MSBuild reports it wrong in the build completion message. Short from that bad message, I'd guess at an issue with automatic dependencies. This friction got introduced at VS2010 when they moved from the custom VCBuild to MSBuild.

是的,额外的“lib”会产生此警告,两条路径不匹配。实际上并不确定会出现什么问题,最终的.lib文件最终会在lib目录中结束,即使MSBuild在构建完成消息中报告错误也是如此。从那个糟糕的消息中简而言之,我猜测自动依赖的问题。当它们从自定义VCBuild移动到MSBuild时,VS2010引入了这种摩擦。

If you want to get rid of the warning then restore the library project's Output File setting to $(OutDir)$(TargetName)$(TargetExt) and change the Output Directory to ..\..\build\lib\$(Configuration).

如果要删除警告,请将库项目的输出文件设置恢复为$(OutDir)$(TargetName)$(TargetExt),并将输出目录更改为.. \ .. \ build \ lib \ $(配置) 。