如何设置MSBuild VC ++目录 [英] how to set MSBuild VC++ Directories

查看:133
本文介绍了如何设置MSBuild VC ++目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个混合的VB.NET和C ++项目的解决方案.使用Visual Studio 2005时,可以设置工具->选项->项目和解决方案-> VC ++目录",以帮助编译器查找包含文件.使用MSBuild构建相同的解决方案时,我看不到如何传递这些设置.如果不指定此路径,C ++将无法编译.在从Visual Studio构建此解决方案时,它可以完美构建.

I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without this path specified. When building this solution form Visual Studio it build perfectly.

为MSBUild传递此路径的方法是什么?

What is the way to pass this path for MSBUild?

看起来MSBuild没有将路径(或/u开关)传递给vcbuild.相反,从VCBuild开始依赖项失败.

Looks like MSBuild doesn't pass the path (or the /u switch) to vcbuild. Starting from VCBuild instead fails on dependency.

推荐答案

要设置包含目录,可以将它们添加到INCLUDE环境变量中.您使用与PATH env中相同的格式.变量-使用分号分隔路径.

To set the include directories, you can add them into your INCLUDE environment variable. You use the same format as in PATH env. variable - you separate paths with semicolons.

要设置库目录,您可以通过类似的方法将其放入LIB环境变量中.

To set the library directories - you can do it in similar way, by putting them into your LIB environment variable.

要设置环境变量,只需右键单击我的电脑",然后选择属性".然后转到高级"选项卡,然后有一个名为环境变量"的按钮.

To set environment variables, you simply right-click "My Computer", choose "Properties". Then you go to "Advanced" tab, and there's a button called "Environment Variables".

或者,您可以从BATCH脚本运行MSBuild,在这种情况下,可以在调用MSBuild之前设置INCLUDE和LIB变量,如下所示:

Or, you can run MSBuild from a BATCH script, in which case, before calling MSBuild, you can set the INCLUDE and LIB variables, like so:

set INCLUDE=C:\Libraries\LibA\Include
set LIB=C:\Libraries\LibA\Lib\x86

这篇关于如何设置MSBuild VC ++目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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