在 Visual Studio 中显示 C++ 文件的 #include 层次结构

Displaying the #include hierarchy for a C++ file in Visual Studio(在 Visual Studio 中显示 C++ 文件的 #include 层次结构)
本文介绍了在 Visual Studio 中显示 C++ 文件的 #include 层次结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我有一个大型 Visual C++ 项目,我正尝试将其迁移到 Visual Studio 2010.它包含来自不同来源和不同时代的大量内容.我遇到了问题,因为某些内容同时包含 winsock.hwinsock2.h.

Problem: I have a large Visual C++ project that I'm trying to migrate to Visual Studio 2010. It's a huge mix of stuff from various sources and of various ages. I'm getting problems because something is including both winsock.h and winsock2.h.

问题:有哪些工具和技术可以显示 Visual Studio C++ 源文件的 #include 层次结构?

Question: What tools and techniques are there for displaying the #include hierarchy for a Visual Studio C++ source file?

我知道 cl/P 用于获取预处理器输出,但这并没有清楚地显示哪个文件包含哪些其他文件(在这种情况下,/P 输出是 376,932 行 8-)

I know about cl /P for getting the preprocessor output, but that doesn't clearly show which file includes which other files (and in this case the /P output is 376,932 lines long 8-)

在一个完美的世界中,我想要分层显示哪些文件包含哪些其他文件,以及行号,以便我可以跳转到源代码:

In a perfect world I'd like a hierarchical display of which files include which other files, along with line numbers so I can jump into the sources:

source.cpp(1)
  windows.h(100)
    winsock.h
  some_other_thing.h(1234)
    winsock2.h

推荐答案

有个设置:

项目设置 -> 配置属性 -> C/C++ -> 高级 -> 显示包含

Project Settings -> Configuration Properties -> C/C++ -> Advanced -> Show Includes

这将生成树.它映射到编译器开关 /showIncludes

that will generate the tree. It maps to the compiler switch /showIncludes

这篇关于在 Visual Studio 中显示 C++ 文件的 #include 层次结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)