1

I'm writing a node.js module using C++ and node-gyp but when I fix all the errors, like in this question, which included getting rid of redundant declarations by adding

#ifndef BUILDING_NODE_EXTENSION

and

#endif  

to my files. Then I get the error

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)

but when I remove them everything works fine, instead I just get compiler warnings like

  CXX(target) Release/obj.target/graph/graph/addon.o
../graph/addon.cc:2:9: warning: 'BUILDING_NODE_EXTENSION' macro redefined
#define BUILDING_NODE_EXTENSION

I don't get why this would be, And I would like to get rid of the compiler warnings if possible. Have any ideas?

Community
  • 1
  • 1
Loourr
  • 4,995
  • 10
  • 44
  • 68

2 Answers2

0

Looks like you have either forgotten to use the NODE_MODULE macro or the name for your module in the binding.gyp does not match what is used in the NODE_MODULE

cody
  • 3,233
  • 1
  • 22
  • 25
0

To get rid of the compiler warnings, try replacing

#define BUILDING_NODE_EXTENSION

with

#define BUILDING_NODE_EXTENSION 1
preoccu panda
  • 179
  • 1
  • 4