简体   繁体   English

在 Visual Studio IDE 中使用 C/C++ 预处理器宏

[英]Working with C/C++ preprocessor macros in Visual Studio IDE

There can be a macro definition somewhere in my project:在我的项目中某处可能有一个宏定义:

#define A 1

In another place of my project, there are such piece of code:在我项目的另一个地方,有这样一段代码:

#ifdef A

do_something()

#endif

When I move mouse pointer to "ifdef" Visual Studio 2010 IDE shows "#define A 2".当我将鼠标指针移动到“ifdef”时,Visual Studio 2010 IDE 显示“#define A 2”。

That is fine, but how can I understand, in which file VS seeing this macro definition?那很好,但是我怎么能理解,在哪个文件 VS 中看到了这个宏定义?

It is being pulled from a data structure inside MSVC它是从 MSVC 内部的数据结构中提取的

As you type and create data types and macros and function, MSVC adds that information to an internal symbol table.当您键入和创建数据类型和宏以及 function 时,MSVC 会将这些信息添加到内部符号表中。 When you hover over an identifier, it does a lookup on it and then can display the information as you see it.当您通过标识符 hover 时,它会对其进行查找,然后可以显示您看到的信息。

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

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