如何在Visual Studio 2010中设置宏?

时间:2022-08-27 20:26:37

I'm trying to use the fix from 'int8_t' : redefinition error in config.h when trying to connect mysql cpp connector to visual studio 2010 which suggests setting a macro

我正在尝试使用'int8_t'中的修复:在尝试将mysql cpp连接器连接到visual studio 2010时,在config.h中重新定义错误,建议设置一个宏

HAVE_INT8_T=1

HAVE_INT8_T = 1

I know how to use the Preprocessor to define variables, but in that case, I would have expected the answer to be in the form

我知道如何使用预处理器来定义变量,但在这种情况下,我希望答案可以在表单中

#define HAVE_INT8_T 1

#define HAVE_INT8_T 1

Is this an equivalent suggestion? Or do I need to set the macro in a project settings menu somewhere?

这是一个相同的建议吗?或者我是否需要在某个项目设置菜单中设置宏?

If so, I've read the documentation for Property Pages, but I can't locate the Macros menu. A screenshot would be helpful, if this is the way I need to go.

如果是这样,我已阅读Property Pages的文档,但我无法找到Macros菜单。如果这是我需要的方式,屏幕截图会有所帮助。

1 个解决方案

#1


1  

The scope is different if you declare it into the property pages for the entire Project or into just one file:

如果将其声明为整个Project的属性页或仅声明一个文件,则范围会有所不同:

如何在Visual Studio 2010中设置宏?

If you need that into one file only (or if you're comfortable with a header for that), go for it. Otherwise do it at project scope.

如果您只需要将其放入一个文件中(或者如果您对标题感到满意),那就去吧。否则在项目范围内进行。

#1


1  

The scope is different if you declare it into the property pages for the entire Project or into just one file:

如果将其声明为整个Project的属性页或仅声明一个文件,则范围会有所不同:

如何在Visual Studio 2010中设置宏?

If you need that into one file only (or if you're comfortable with a header for that), go for it. Otherwise do it at project scope.

如果您只需要将其放入一个文件中(或者如果您对标题感到满意),那就去吧。否则在项目范围内进行。