Node-gyp cannot compile a nodejs extension ('fatal error, thread' file not found)

烈酒焚心 提交于 2019-12-06 10:48:10
mscdex

You need to also add -std=c++11 to your cflags argument list in order to fully activate C++11 support.

UPDATE: For OSX specifically (the cflags should work on BSD and Linux), you will need to also add a condition inside your targets settings like so:

{
    "targets": [
    {
        "target_name": "overcpu",
        "sources": [ "overcpu.cpp" ],
        "cflags" : [ "-std=c++1", "-stdlib=libc++" ],
        "conditions": [
          [ 'OS!="win"', {
            "cflags+": [ "-std=c++11" ],
            "cflags_c+": [ "-std=c++11" ],
            "cflags_cc+": [ "-std=c++11" ],
          }],
          [ 'OS=="mac"', {
            "xcode_settings": {
              "OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ],
              "OTHER_LDFLAGS": [ "-stdlib=libc++" ],
              "MACOSX_DEPLOYMENT_TARGET": "10.7"
            },
          }],
        ],
    }
    ]
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!