簡體   English   中英

使用node-gyp編譯時CFLAGS在Windows上不起作用

[英]CFLAGS not working on Windows when compiling with node-gyp

由於某些原因,當我在Windows上使用node-gyp進行編譯時,CFLAGS被忽略。 有人知道原因嗎? 這是我的代碼:

綁定文件

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

helloWindows.cpp

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);

#endif

提前致謝 :)

解決:

"defines":["_MY_FLAG"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM