Sebastia.Net Sebastia.Net - 2 months ago 12
C++ Question

how to locate 'imqi.hpp' from node-gyp

I am trying to use "nan" module to call MQ_CONNECT() from node.js

See

Node.js and C/C++ integration: how to properly implement callbacks?
and
https://github.com/nodejs/nan

When I use "node-gyp" it says it can not find "imqi.hpp", the MQ header

As far as I can see, the path to MQ includes has to be provided in "binding.gyp", and I have tried this without success:

{
"targets": [
{
"target_name": "mqconn",
"sources": [
"initall.cc",
"mqconn.cc"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"c:\MQ\tools\cplus\include"
]
}
]
}


Does anyboby have a clue on how to fix this ?
Sebastian.

PD.- of course, the file is where the path indicates:

c:\>dir c:\MQ\tools\cplus\include\imqi.hpp
Volume in drive C is OS
Volume Serial Number is 12AA-0601

Directory of c:\MQ\tools\cplus\include

27/06/2013 02:00 1.538 imqi.hpp

Answer

Because binding.gyp is in JSON, the String "c:\MQ\tools\cplus\include"is a standard JavaScript String, and therefore the \ needs to be escaped to \\.

So you should replace "c:\MQ\tools\cplus\include" into "c:\\MQ\\tools\\cplus\\include".

I hope that fixes the problem...

Comments