Unable to link my C++ library with electron


#1

Hi,

I have my own c++ library and I want to use it in my electron app, but when l try to launch my app the following error appears : :

If I use my addon out of the electron app it runs correctly.

My electron app main process :


'use strict';
const addon = require('./build/Release/addon.node');
const electron = require('electron');
const app = electron.app; //Module to control application life
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window
const ipcMain = electron.ipcMain;
var mainWindow = null;


app.on('window-all-closed',function(){
  if(process.platform != 'darwin'){
    app.quit();
  }
});

app.on('ready',function(){
  mainWindow = new BrowserWindow({width:800,height:600});

  mainWindow.loadURL('file://'+ __dirname + '/static/index.html');
});

app.on('closed',function(){
  mainWindow = null;
});

ipcMain.on('rInt',function(event, arg){
  obj = new addon.RandomGenerator(false);
  console.log(obj.oneRandomInt());
  obj=null;
});

Let me know if you need more information.


#2

Did you rebuild your native module for Electron as specified in https://github.com/atom/electron/blob/v0.36.5/docs/tutorial/using-native-node-modules.md ?


#3

Yes,

I only tried the easy way cause I don’t understand how to use the other ways on windows.


#4

It’s finally work with node-gyp way, I think I don’t sleep enough last night.

Anyway, thanks for your quick answer !