我正在尝试创建一个 Node C++ 模块来与 Steam api 交互。库文件是./steam/lib/linux64/libsteam_api.so,头文件在./steam。
我创建了一个小的常规 C++ 文件进行测试,它成功使用了 Steam api,使用#include "steam_api.h"
. 我已经像这样编译并导入了共享库:g++ -L./steam/lib/linux64 -Wl,-rpath=./steam/lib/linux64 -Isteam -lsteam_api main.cpp
绑定.gyp:
{
"targets": [ {
"target_name": "steam",
"sources": [ "steam.cpp" ],
"include_dirs": [
"steam",
"<!@(node -p \"require('node-addon-api').include\")"
],
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"libraries": [ "./steam/lib/linux64/libsteam_api.so" ]
} ]
}
当我尝试使用 node-gyp 编译 Node 模块时,我得到 g++: error: ./steam/lib/linux64/libsteam_api.so: No such file or directory
如何正确导入共享库?