camme / node-nfc

A first try at binding libnfc to node. This project is right now not good enough to use.
68 stars 39 forks source link

error: call to 'New' is ambiguous #16

Closed faizshukri closed 8 years ago

faizshukri commented 8 years ago
In file included from ../src/nfc.cc:6:
In file included from ../node_modules/nan/nan.h:190:
../node_modules/nan/nan_new.h:208:10: error: call to 'New' is ambiguous
  return imp::Factory<T>::New(arg0);
         ^~~~~~~~~~~~~~~~~~~~
../src/nfc.cc:83:78: note: in instantiation of function template specialization 'Nan::New<v8::Int32, unsigned long>'
      requested here
            if(offset) object->Set(Nan::New("offset").ToLocalChecked(), Nan::New<Int32>(offset));
                                                                             ^
../node_modules/nan/nan_new.h:113:26: note: candidate function
  static inline return_t New(int32_t value);
                         ^
../node_modules/nan/nan_new.h:114:26: note: candidate function
  static inline return_t New(uint32_t value);

It seem to work if I cast offset from Nan::New<Int32>(offset)) into Nan::New<Int32>((int)offset))

xantrix commented 8 years ago

I got the same issue and using your suggestion the project built correctly but it fails during nfc reading:

xan@xan-K52Jc:~/newhtdocs/nfc-test/node-nfc$ node test.js 
version: { name: 'libnfc', version: '1.7.1' }
devices: { 'acr122_usb:002:008': 
   { name: 'ACS / ACR122U PICC Interface',
     info: 
      { chip: 'PN532 v1.6',
        'initator mode modulations': 
         { 'ISO/IEC 14443A': [ '106 kbps' ],
           FeliCa: [ '424 kbps', '212 kbps' ],
           'ISO/IEC 14443-4B': [ '106 kbps' ],
           'Innovision Jewel': [ '106 kbps' ],
           'D.E.P.': [ '424 kbps', '212 kbps', '106 kbps' ] },
        'target mode modulations': 
         { 'ISO/IEC 14443A': [ '106 kbps' ],
           FeliCa: [ '424 kbps', '212 kbps' ],
           'D.E.P.': [ '424 kbps', '212 kbps', '106 kbps' ] } } } }

{ deviceID: 'acr122_usb:002:008',
  name: 'ACS / ACR122U PICC Interface' }
{ deviceID: 'acr122_usb:002:008',
  name: 'ACS / ACR122U PICC Interface',
  uid: 'f4:20:35:76',
  type: 4,
  tag: 'mifare-classic',
  data: <Buffer 00 00 00 00 00 00 00 00 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 62 3a 30 30 32 3a 30 30 38 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 ... >,
  offset: 64 }
[]
stopped
*** Error in `node': free(): invalid pointer: 0x00007fbb0c000a30 ***
Aborted (core dumped)

Any suggestion? cc @jeroenvollenbrock Thank you in advance

jeroenvollenbrock commented 8 years ago

@xantrix: Could you try applying the fix to this fork: https://github.com/athombv/node-nfc ?

xantrix commented 8 years ago

@jeroenvollenbrock I applied your fix at https://github.com/athombv/node-nfc/pull/1/files and it works like a charm! Thanks a lot!

jeroenvollenbrock commented 8 years ago

Good to hear, i'll prepare a pull request.

jeroenvollenbrock commented 8 years ago

Fixed in #18