使用#ifndef中断节点gyp模块
Using #ifndef breaks node-gyp module
我正在使用C++
和node-gyp
编写一个node.js
模块,但当我修复了所有错误时,比如在这个问题中,其中包括通过添加来消除冗余声明
#ifndef BUILDING_NODE_EXTENSION
和
#endif
到我的文件。然后我得到错误
module.js:356
Module._extensions[extension](this, filename);
^
Error: Symbol graph_module not found.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/home/project/test.js:1:75)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
但当我删除它们时,一切都很好,相反,我只收到像这样的编译器警告
CXX(target) Release/obj.target/graph/graph/addon.o
../graph/addon.cc:2:9: warning: 'BUILDING_NODE_EXTENSION' macro redefined
#define BUILDING_NODE_EXTENSION
我不明白为什么会这样,如果可能的话,我想去掉编译器警告。有什么想法吗?
看起来您忘记使用NODE_MODULE宏,或者绑定中模块的名称与NODE_MODULE 中使用的名称不匹配
要消除编译器警告,请尝试替换
#define BUILDING_NODE_EXTENSION
带有
#define BUILDING_NODE_EXTENSION 1
相关文章:
- 尝试导入pybind-opencv模块时出现libgtk错误
- node-gyp 在 macOS 上未正确链接库
- 为什么当我解模块化时,这个C++代代码"效率较低"?
- 如果C++对象的类在另一个boost模块中声明,如何使用boost将指向该对象的指针返回到python
- 内联如何影响模块接口中的成员函数
- C++返回 Numpy 数组的 Python 扩展模块
- 当我尝试加载内核模块时,如何修复C++中的这个 malloc() 错误?
- 如何从线程中的不同模块调用函数?
- 如何使用 soong 命名空间来有条件地编译模块
- asn1c 不会从 asn.1 模块中提取八位字节字符串的默认值
- CMake - 模块 + 库混淆
- node-gyp 的先有鸡还是先有蛋的问题:指向依赖项中的头文件
- 特征 LLT 模块给出不正确的结果?
- 枚举进程模块在有效句柄上返回无效句柄
- 在 python 模块中导入子模块时PyImport_Import失败
- 将 PCL 链接到 Cython C++ 模块
- 即使直接从官方示例中复制,也找不到未知类型名称QML_ELEMENT和 QML 模块
- 电源功能模块化操作
- 使用#ifndef中断节点gyp模块
- (PPC64le) 链接到 protobuf 的模块的节点 gyp 重建失败,"lacks nop, can't restore toc; recompile with -fPIC"