MS Visual C/C ++的LIB和LIBPATH环境变量之间有什么区别? [英] What is the difference between the LIB and LIBPATH environment variables for MS Visual C/C++?

查看:121
本文介绍了MS Visual C/C ++的LIB和LIBPATH环境变量之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究一些构建脚本,这困扰了我.我想确保我们独立于环境设置,但是为了确保这一点,我觉得有必要了解工具如何/在何处使用设置.

I've been working on some build scripts, and this is bugging me. I want to be sure that we're independent of environment settings, but in order to be sure of that I feel a need to understand how/where the settings are used by the tools.

Visual Studio命令提示符和/或vcvarsall.bat文件设置了两个不同的环境变量:LIB和LIBPATH.值不同,但部分重叠.这是我系统中的值:

The Visual Studio command prompt and/or vcvarsall.bat file set up two distinct environment variables: LIB and LIBPATH. The values are different, but partially overlapping. Here are the values from my system:

LIB=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x86;

LIBPATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral;

我只想了解具有两个不同变量的原理-比LIBPATH带来更多库这一显而易见的事实要多一点.我尝试查找它,但是没有找到关于链接器和/或开发环境何时使用它们的明确定义.

I'd just like to understand the rationale for having two different variables -- a little more than the obvious fact that LIBPATH brings in more libs. I've tried looking it up, but I haven't found a clear definition of when each is used by the linker and/or the dev environment.

推荐答案

LIB用于链接程序,可帮助它找到导入库和静态库.

LIB is for the linker, helps it find import and static libraries.

LIBPATH用于编译器,可帮助其查找元数据文件.像类型库,.NET程序集,WinRT .winmd文件.

LIBPATH is for the compiler, helps it find metadata files. Like type libraries, .NET assemblies, WinRT .winmd files.

这篇关于MS Visual C/C ++的LIB和LIBPATH环境变量之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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