如何根据“配置管理器”创建自己定义的常量?

编程入门 行业动态 更新时间:2024-10-24 04:50:27
本文介绍了如何根据“配置管理器”创建自己定义的常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我选择Debug配置时, DEBUG 常数处于活动状态。当我选择Release配置时, DEBUG 常数不活动。

如何创建自己的配置使它们包含我自己定义的常量。基本上,我想要这样,如果我选择配置FOOBAR有一个常数 FOO 和 BAR 我的项目活跃。

我基本上试图避免在我的项目中插入一堆 #define FOO

解决方案

根据本文您可以在构建中定义编译常数

EDITED:要定义构建配置,你可以去Build> Configuration manager,我想你也可以定义编译常量。 p>

When I select the "Debug" configuration, the DEBUG constant is active. When I select the "Release" configuration, the DEBUG constant is inactive.

How can I create my own configurations so that they include my own defined constants. Basically, I want it so that if I select the configuration "FOOBAR" that there is a constant FOO and BAR in my project active.

I'm basically trying to avoid putting in a bunch of #define FOO in my projects, then commenting/uncommenting them out when I need/don't need them.

解决方案

According to this article you can define compilation constants in the build tab of your project properties.

EDITED: To define build configurations you can go to Build > Configuration manager and I think you can define compilation constants there too.

更多推荐

如何根据“配置管理器”创建自己定义的常量?

本文发布于:2023-11-08 11:18:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569220.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:常量   管理器   定义

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!