Giter Site home page Giter Site logo

bluetron's People

Contributors

eavelardev avatar jinnsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bluetron's Issues

error C2011: 'timespec': 'struct' type redefinition

OS: Windows 10
Visual Studio 2015

libusb library problem, building for electron

I adding the next code in the gulpfile.js file to solving the error, between fix-node-usb and rebuild-usb tasks

gulp.task('add-timespec-def', ['fix-node-usb'], () => {
  // Add HAVE_STRUCT_TIMESPEC definition
  if (platform === 'win32') {
    var fs = require('fs')
    var file = 'app\\node_modules\\usb\\libusb\\libusb\\os\\threads_windows.h'
    var data = fs.readFileSync(file).toString().split("\n")
    data.splice(43, 0, '#define HAVE_STRUCT_TIMESPEC')
    var text = data.join("\n")
    fs.writeFile(file, text, function (err) {
      if (err) return console.log(err)
    });
  }
})

And edit the rebuild-usb task ading add-timespec-def task

gulp.task('rebuild-usb', ['add-timespec-def'], () => {

This isn't a good solution. The position of the HAVE_STRUCT_TIMESPEC in threads_windows.h file, can change in other libusb versions.

Other solution that is most better.

gulp.task('add-timespec-def', ['fix-node-usb'], () => {
  // Add HAVE_STRUCT_TIMESPEC and _TIMESPEC_DEFINED definition
  if (platform === 'win32') {
    var fs = require('fs')
    var file = 'app\\node_modules\\usb\\libusb.gypi'
    var data = fs.readFileSync(file).toString().split("\n")
    data.splice(126, 0, '          \'defines\':[')
    data.splice(127, 0, '            \'HAVE_STRUCT_TIMESPEC=1\',')
    data.splice(128, 0, '            \'_TIMESPEC_DEFINED=1\'')
    data.splice(129, 0, '           ]')
    var text = data.join("\n")
    fs.writeFile(file, text, function (err) {
      if (err) return console.log(err)
    });
  }
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.