简体   繁体   English

如何在VC ++项目中定义环境变量/宏?

[英]How do I define an environment variable/macro in a VC++ project?

I'm trying to build FTGL in Visual C++ 2008. According to the documentation, I need to define a macro called $(FREETYPE) containing the path to the FreeType library code, but I'm having a heck of a time figuring out how that's done. 我正在尝试在Visual C ++ 2008中构建FTGL 。根据文档,我需要定义一个名为$(FREETYPE)的宏,其中包含FreeType库代码的路径,但是我花了一些时间弄清楚如何完成了

I've been all over the project options and the Visual C++ options, and I can't find the place to define this macro anywhere. 我到处都是项目选项和Visual C ++选项,但找不到在任何地方定义此宏的地方。 When I look for help online, all I find is stuff talking about how to define an environment variable in the debugger (not helpful when I'm trying to compile) or other pages saying to define it as a literal environment variable in the Control Panel, which is kind of ridiculous. 当我在线寻求帮助时,我发现的全部是关于如何在调试器中定义环境变量的信息(当我尝试进行编译时无济于事)或其他在控制面板中将其定义为文字环境变量的页面。 ,这有点荒谬。 It smacks of using global state to manage a local problem . 使用全球状态来管理局部问题显得有些草率。

I'm completely lost here. 我在这里完全迷路了。 I'm used to using Delphi, where doing this is trivial, and I can't believe that no mechanism for setting this macro exists anywhere in the Visual Studio IDE, so I figure I must be overlooking something. 我习惯使用Delphi,在这里这样做很简单,而且我不相信在Visual Studio IDE中的任何地方都没有设置此宏的机制,因此我认为我必须忽略一些东西。 Does anyone know the right place to define it so things will compile right? 有谁知道定义它的正确位置,以便事情能够正确进行编译?

Well if nothing else works just define it in windows 好吧,如果没有其他作用,只需在Windows中定义它

Computer / Properties / Advanced System settings / Environment Variables 计算机/属性/高级系统设置/环境变量

define FREETYPE= to whatever you want to set it then restart visual studio for it to take effect. FREETYPE=定义为要设置的内容,然后重新启动Visual Studio以使其生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM