如何在VC ++的解决方案中定义全局设置? [英] How to have global settings defined in a solution in VC++?

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

问题描述

我有许多解决方案,其中包含大量项目.我希望能够为所有项目使用的解决方案定义全局设置.例如,包含目录.我希望能够在一处更改解决方案中所有项目的include目录.

I have a number of solutions with a large number of projects in them. I would like to be able to define global settings for the solution that are used by all projects. For example an include directory. I want to be able to change the include directory in one place for all projects in the solutions.

当我寻找解决方案时,我发现了一个很好的问题描述,该问题完全匹配,但此处建议的解决方案(项目属性表)是针对每个项目而不是针对每个解决方案定义的.

When I searched for a solution I found a good description of the problem that matches mine exactly but the solution suggested there, project property sheets, are defined per project and not per solutions.

我可以使用环境变量或Visual Studio设置,但是随后需要编译代码的每个人都必须定义完全相同的设置.

I could use environment variables or Visual studio settings, but then everyone that needs to compile the code has to define the exact same settings.

有人可以建议一种方法吗?谢谢.

Can anyone suggest a way to do this? Thanks.

推荐答案

我们使用属性表来完成此任务.可以将一个属性表分配给解决方案中的所有项目.从那时起,您可以在一个属性表中更改设置,它将影响所有项目.

We use property sheets to accomplish this. A single property sheet can be assigned to all the projects in the solution. From then on you can change a setting in that one property sheet and it will affect all the projects.

高级技巧:我们实际上使用了多个属性表(例如,一个用于发布目标类型,一个用于调试目标类型).提示是顺序很重要.如果您正在手动编辑项目文件,则最后一个属性表将覆盖列表中前一个属性表中的设置.如果您要在GUI中进行编辑,则TOP优先于其下方的内容.

Advanced tip: We actually use multiple property sheets, (e.g. one for release target types, one for debug target types). The tip is that the order is very important. If you're editing the project files by hand then the last property sheet will override settings in the previous property sheets in the list. If you're editing in the GUI, then the TOP one overrides the ones below it.

这篇关于如何在VC ++的解决方案中定义全局设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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