简体   繁体   中英

how to quickly debug C++ include file problems

Very often we encounter this kind of issues like below:

1>Compiling...
1>a.cpp
1>c:\apps\b.h(22) : fatal error C1083: Cannot open include file: 'boost/shared_ptr.hpp': No such file or directory

Sometimes it could be tedious as there a many include files and even nested include files in a big project.

What is the best way to trace / which include file is the culprit(parent) that include the problematic include file?

The problem is it has nested include, so will need to spend some effort before able to tell which file actually include bh

Looks like you're on Windows (thus maybe using Microsoft C/C++ compiler). In that case you can use the /showIncludes Option. Also see this SO answer .

This allows you to "visually" see which header file includes which, giving you some more information.

Update: Apparently GCC has some similar options .

Autotools has this feature. You can check whether certain header files are present or not.. I'm sure other build tools have similar features...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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