我正在尝试使用“nan”模块从 node.js 调用 MQ_CONNECT()
见
Node.js and C/C++ integration: how to properly implement callbacks? 和 https://github.com/nodejs/nan
当我使用“node-gyp”时,它说找不到“imqi.hpp”,MQ header
据我所知,必须在“binding.gyp”中提供 MQ include 的路径,我已经尝试过但没有成功:
{
"targets": [
{
"target_name": "mqconn",
"sources": [
"initall.cc",
"mqconn.cc"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"c:\MQ\tools\cplus\include"
]
}
]
}
有人知道如何解决这个问题吗? 塞巴斯蒂安。
PD.- 当然,文件是路径指示的地方:
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
最佳答案
因为 binding.gyp 在 JSON 中,字符串 "c:\MQ\tools\cplus\include"
是一个标准的 JavaScript 字符串,因此 \
需要被转义为 \\
。
所以你应该将 "c:\MQ\tools\cplus\include"
替换成 "c:\\MQ\\tools\\cplus\\include"
.
我希望能解决问题...
关于c++ - 如何从 node-gyp 定位 'imqi.hpp',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30897604/