从 C++ 代码文件设置 #include 目录 [英] Set #include directory from C++ code file

查看:72
本文介绍了从 C++ 代码文件设置 #include 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MSVC++ 中,你总是可以做到

<前>#pragma comment( lib, "libname.lib" )

从代码文件链接库,而不是摆弄项目选项对话框.

我正在寻找一种从代码文件中添加附加包含目录"的方法,而不是使用项目设置/配置属性/C、C++/常规/附加包含目录.

有没有办法做到这一点?

解决方案

那是不可能的.如果您在编写代码时已经知道标头的存储位置,那么您应该在 #include 指令中包含路径.

In MSVC++ you can always do

#pragma comment( lib, "libname.lib" )

TO link a library in from a code file, instead of fiddling with the project options dialog.

I'm looking for a way to add "Additional Include Directories" from the code file instead of using Project Settings/Configuration Properties/C,C++/General/Additional Include Directories.

Is there a way to do this?

解决方案

That's not possible. If you already know where the header is stored when you write the code then you should include the path in the #include directive.

这篇关于从 C++ 代码文件设置 #include 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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