问题
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"
The folder which folder_a is in is included in the project's c++ include directory.
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.
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.
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.
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?
I'm trying to avoid:
#include "../../../parent_folder/folder_a/sub_folder_b/file_name.h"
But I'll do it if I have to.
回答1:
Add path of the file in
Project Properties->Resources->Additional Include Directories: ../../../parent_folder/folder_a/sub_folder_b
回答2:
Think this link will help you. How to: Specify Include Directories for Resources
来源:https://stackoverflow.com/questions/12367627/resource-rc-file-include-header-ignores-visual-studio-project-include-paths