Node GYP Static Library on Windows

雨燕双飞 提交于 2020-01-13 06:45:09

问题


I'm trying to link a Static Library to a node.js addon in windows.

I used Visual Studio 2013 Express to create a .lib library and I link it in the binding.gyp file as follows:

{
  "targets": [
    {
      "target_name": "modbus",
      "sources": [
        "modbus.cc"
      ],
      "include_dirs": [
        "<!(node -e \"require('nan')\")",
        "lib/libmodbus/src"
      ],
      "libraries": [
        "-l<(module_root_dir)/lib/libmodbus/src/win32/modbus.lib"
      ]
    }
  ]
}

When I run node-gyp rebuild I recieve errors like:

modbus.obj : error LNK2001: external symbol __imp_modbus_connect not resolved

It's clear that it doesn't find the library methods. What do I do wrong?

来源:https://stackoverflow.com/questions/39408839/node-gyp-static-library-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!