[英]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. 我正在使用ac项目,需要在其中包含一个头文件,该头文件中只有很少的其他头文件。 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. 更清楚地说,我需要在当前程序中使用
xxx.h
文件,该文件仅对我有用。 But xxx.h
file got some other yyy.h
included in it. 但是
xxx.h
文件中包含其他一些yyy.h
When I compile I am having the below error: 编译时出现以下错误:
xxx.h
: fatal error C1083: Cannot open include file:yyy.h
: No such file or directoryxxx.h
:致命错误C1083:无法打开包含文件:yyy.h
:没有此类文件或目录
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? 任何人都可以建议我一种方法来包括
xxx.h
文件,并在我当前的项目中使用我需要的唯一函数,包括yyy.h
?
use #ifdef
blocks to prevent the unwanted headers to be included. 使用
#ifdef
块以防止包含不需要的标头。
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 现在,通过定义MY_APP来编译您的应用
Like in gcc 像在gcc中
$gcc -DMY_APP ....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.