Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js Add-on with GYP "exceptions"

I'm trying to make a C++ library to a node.js add-on.

Problem is on build time it errors like:

error: no member named 'runtime_error' in namespace 'std' throw std::runtime_error

Is there something I can replace runtime_error with to get rid of this errors? I tried to disable it with:

'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],

But no luck


I found this discussion. And it seems like I have the same question as the guy at the bottom but he didn't get any answer.

like image 838
majidarif Avatar asked Jan 20 '26 17:01

majidarif


2 Answers

What I've done in some of my addons (e.g. sipster) was just add the flag instead of trying to negate it:

'cflags_cc': [ '-fexceptions' ],

That works for me with at least node v0.10.x.

like image 157
mscdex Avatar answered Jan 22 '26 05:01

mscdex


You can add

'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',

to your xcode_settings, that did it for me.

Hope it helps.

like image 34
Sébastien Lemieux Avatar answered Jan 22 '26 05:01

Sébastien Lemieux