C / C ++:如何找出给定定义的头文件链? [英] C/C++: How to figure out the chain of header files for a given definition?

查看:119
本文介绍了C / C ++:如何找出给定定义的头文件链?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual C ++中,您可以找到头部文件,其中任何名称(变量或类型)是定义按F12或选择 。此功能非常实用,但仅显示定义名称的最终位置(头文件)。有没有办法找出从我的源文件到给定名称的最终头文件的头文件的

In Visual C++, one can find the header file where any name (variable or type) is defined by pressing F12 on it or choosing Go to Definition. This feature is very useful, but it only shows the final location (header file) where the name is defined. Is there a way to figure out the chain of header files that lead from my source file to the final header file for a given name?

例如,考虑下面的代码:

For example, consider this code:

// main.cpp    
#include <stddef.h>
int main()
{
    size_t s;
    return 0;
}

在Visual C ++ 2010中,如果我查找<$ c $在上面的 main.cpp 中使用了c> size_t ,它会将我归入名为 sourceannotations.h 。我知道这个头链以 stddef.h (我已经包括)开头,并以 sourceannotations.h 结尾。

In Visual C++ 2010, if I look up the definition of size_t in the above main.cpp, it lands me in some file named sourceannotations.h. I know that this header chain begins with stddef.h (which I have included) and ends in sourceannotations.h. How to figure out the links in the middle of this chain?

推荐答案


  1. 右键单击项目,项目属性

  2. 配置属性 - >C / C ++ - >高级。

  3. 将显示包含 。

当您编译每个文件时,标题的完整层次结构将在输出窗口中打印出来。

The complete hierarchy of headers will be printed out in the output window when you compile every file.

这篇关于C / C ++:如何找出给定定义的头文件链?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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