使用node-gyp
构建我的C ++代码时遇到了一些问题。我想在子目录中包含一些包含* .h文件的目录,但它总是显示错误No such file or directory
。有node-gyp
经验的人是否可以给我一些建议。
这是我的目录结构
----libraries
----library
----modules.h // define a_module.h in modules.h
----a_module.h
----a_module.cpp
----src
----main.h
----binding.gyp
----addon.cc
和我的binding.gyp
文件位于:
{
"targets": [
{
"target_name": "addon",
"sources": [
"addon.cc",
"./libraries/src/main.cpp"
],
"include_dirs": [
],
"dependencies": [
"libs"
]
},
{
"target_name": "libs",
"type": "<(library)",
"include_dirs": [
"./libraries/libraru/",
]
}
]
}
我也尝试下面的配置:
{
"targets": [
{
"target_name": "addon",
"sources": [
"addon.cc",
"./libraries/src/main.cpp"
],
"include_dirs": [
"./libraries/library/"
]
}
]
}
我尝试使用以下路径调用我的程序:main.cc
- &gt; main.h
- &gt; modules.h
- &gt; a_module.h
- &gt; a_module.cpp
。
main.cc
#include "./libraries/src/main.h"
main.h
#include "library/modules.h" // <- No such file or directory error occurred
我的binding.gyp
文件有什么问题吗?
感谢您查看我的问题。