我正在编写nodejs代码,并希望使用node-gyp进行编译,使用C ++代码(backend.cpp,其中包括'mysql / mysql.h')。我在构建时遇到此错误:
module.js:356 模块。 extensions [扩展名](this,filename); ^ 错误: ____ /build/Release/backend.node:undefined symbol:mysql_init
有人可以帮忙吗?如何指示node-gyp将mysql.h链接到目标backend.node? p>
答案 0 :(得分:2)
您是否已将其添加到binding.gyp文件的libraries
列表中?
这是一个简短的例子:
{
"targets": [
{
"target_name": "backend",
"sources": [<comma separated source names>],
"include_dirs":[<comma separated include dirs>],
"libraries": [<comma separated library paths>]
}
]
}
您还应该查看完整的Gyp Language Specification