资源(.rc)文件包含标题忽略visual studio项目包含路径 [英] resource (.rc) file include header ignores visual studio project include paths

查看:470
本文介绍了资源(.rc)文件包含标题忽略visual studio项目包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在资源文件(.rc)中包含头文件。
路径类似于folder_a / sub_folder_b / file_name.h

I'm trying to include a header file in a resource file (.rc). The path is something like "folder_a/sub_folder_b/file_name.h"

folder_a的文件夹in in包含在项目的c ++ include目录中。

The folder which folder_a is in is included in the project's c++ include directory.

当我在同一项目的.cpp文件中编写相同的#include指令时,它会正确编译,但是对于.rc文件VS找不到头文件。

When I write the same #include directive in a .cpp file in the same project it compiles properly, but for the .rc file VS cannot find the header file.

在源编辑器窗口中,当我右键单击#include指令并选择'打开文档'时,弹出错误哪个声明无法找到该文件,显示它搜索文件的路径,但不显示项目的包含路径。

In the source editor window, when I right click the #include directive and choose 'open document', the popup error which states that it cannot find the file, displays the paths in which it searches for the file but the project's include paths are not displayed.

如果我对虚拟文件执行相同操作#include在.cpp文件中(同样是同一个项目),所有路径都显示在错误消息中。

If I do the same for a dummy #include in the .cpp file (again, same project), all the paths are displayed in the error message.

我的结论是VC ++不使用include dirs在.rc文件中的#include指令的项目中定义。

My conclusion is that VC++ does not use the include dirs defined in the projects for #include directive in .rc files.

这是真的吗?如果不是 - 我做错了什么?如果是的话 - 有没有解决方法呢?

Is this true? If not - what am I doing wrong? If yes - is there a way around it?

我试图避免:

#include../../../ parent_folder / folder_a / sub_folder_b / file_name.h

但是我如果必须的话,我会这样做。

But I'll do it if I have to.

推荐答案

添加文件的路径

Project Properties->Resources->Additional Include Directories: ../../../parent_folder/folder_a/sub_folder_b

这篇关于资源(.rc)文件包含标题忽略visual studio项目包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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