nod-gyp包括dirs不工作

时间:2017-12-13 07:10:41

标签: c++ node.js node-gyp

使用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文件有什么问题吗?

感谢您查看我的问题。

0 个答案:

没有答案