开发者

how to quickly debug C++ include file problems

开发者 https://www.devze.com 2023-03-26 08:31 出处:网络
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 f开发者_运维问答ile: \'boost/shared_ptr.hpp\': No

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 f开发者_运维问答ile: '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 b.h.


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消