使用xbuild编译可视c ++项目时定义目标 [英] defining a target when compiling a visual c++ project using xbuild

查看:83
本文介绍了使用xbuild编译可视c ++项目时定义目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可视化的c ++项目,该项目输出一个库,我想使用xmake在Linux上构建它.我可以在monodevelop中构建它,但是我希望能够从命令行构建它.

I have a visual c++ project that outputs a library and I would like to build it on Linux using xmake. I can build it in monodevelop but I want to be able to build it from a command line.

如果我尝试使用"xbuild"调用来构建项目,则会出现以下错误:

If I try building the project using "xbuild" call then I get the following error:

....ItemMinerLibMono.cproj: error : Target named 'Build' not found in the project.

我从文档中了解到,我需要在csproj文件中添加一个名为"Build"的目标,但我不知道该怎么做.我试过像这样导入Microsoft.Common.targets文件:

I understand from the documentation that I need to add a Target named "Build" in the csproj file but I don't know how to do that. I tried importing the Microsoft.Common.targets file like this:

<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />

但是我得到了错误:

: error : Target 'CreateManifestResourceNames', a dependency of target 'PrepareResources', not found.

有人知道如何从命令行成功编译c ++项目吗?

Does anybody have any idea how to successfully compile a c++ project from a command line?

谢谢, 格里高

推荐答案

从MonoDevelop中向您添加.cproj文件,它将使用xbuild进行构建.

Add the following to you .cproj file from MonoDevelop and it will build with xbuild.

<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" Outputs="$(TargetPath)"/>

可能有一个更简单的解决方案,但是到目前为止,我还无法提出一个解决方案.

There is probably a simpler solution, but so far I have not been able to come up with one.

这篇关于使用xbuild编译可视c ++项目时定义目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆