在Cpp项目中包含头文件 [英] Including header file in Cpp project

查看:101
本文介绍了在Cpp项目中包含头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在我的客户端应用程序中使用库。为此我需要在我的客户端应用程序中包含库函数/类的头文件的路径。

但问题是我没有目录中的所有头文件。还有子目录,其中包含头文件,为此,我需要以递归方式显式添加所有子目录的路径。手动工作太多了。

任何人都可以告诉我有没有办法通过某种工具或其他方式在客户端应用程序中添加所有子目录?



提前致谢

Hi I want to use a library in my client application. For that I need to include path of header files of library functions/classes in my client application.
But the problem is that I dont have all header file in directory. There are subdirectories also which contains header file and for that I need to explicitly add the path of all subdirectories in recursive way. There is too much manual work.
Can anyone please tell me is there any way to add all subdirectories in client application by some tool or any otherway?

Thanks in advance

推荐答案

回答两个 Stack Overflow 问题:如何在Visual Studio中包含子目录? [ ^ ]显示了一个变通方法对于 Visual Studio
Answer two to this Stack Overflow question: "How to include sub-directories in Visual Studio?"[^] shows a workaround for Visual Studio.


您可以在项目设置中添加包含目录。
you can add "include directories" in the project settings.


这看起来像一个奇怪的第三方库,你必须包含来自多个子目录的头文件。

你确定需要这样做吗?



如果是,如果您正在处理 * nix 环境,您可以调用查找* -type d | sed's / ^ \(。* \)
This looks like a strange 3rd party library where you have to include header files from multiple subdirectories.
Are you sure you need to do so?

If yes, and if you are working on a *nix environment, you may call find * -type d | sed 's/^\(.*\)


这篇关于在Cpp项目中包含头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆