简体   繁体   中英

xxx.h: fatal error C1083: Cannot open include file: 'yyyy.h': No such file or directory

I am working with ac project, where I need to include a header file which has few other header files. When I tried to compile compiler is also looking for header files included in the header file I am using.

To be more clear, I am need of using xxx.h file in my current program which has only one useful function to me. But xxx.h file got some other yyy.h included in it.
When I compile I am having the below error:

xxx.h : fatal error C1083: Cannot open include file: yyy.h : No such file or directory

Anyone can please suggest me a way to include xxx.h file and use the only one function I need with including yyy.h to my current project?

use #ifdef blocks to prevent the unwanted headers to be included.

Lets say you need aa prototype of a function , other than this you do not need anything. Then :

#ifndef MY_APP
#include <notneeded1.h>
#include <notneeded2.h>
.............
.............
#endif
#ifdef MY_APP
void my_needed_foo_bar()
#endif

#ifndef MY_APP
.....
#endif

Now compile your app with defining MY_APP

Like in gcc

$gcc -DMY_APP ....

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