Antirreni91 Antirreni91 - 1 year ago 58
Node.js Question

CFLAGS not working on Windows when compiling with node-gyp

For some reason when I compile using node-gyp on Windows, CFLAGS are ignored. Does anyone maybe know the reason? This is my code:


"targets": [
"target_name": "helloWindows",
"sources": [ "helloWindows.cpp" ],
"cflags": [ "-D_MY_FLAG"],


using namespace v8;

#if defined(_MY_FLAG)
void SuperFunction(const v8::FunctionCallbackInfo<Value>& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

args.GetReturnValue().Set(String::NewFromUtf8(isolate, "Hello Antirreni!"));


void init(Handle<Object> target) {
NODE_SET_METHOD(target, "hello", SuperFunction);

NODE_MODULE(helloWindows, init);


Thanks in advance :)

Answer Source

Solved with: