-1
這裏是我的bindings.gyp文件:克++建立與節點GYP錯誤重建的Node.js的附加組件
{
"targets": [
{
"target_name": "hello",
"sources": [ "hello.cpp" ],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"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"
},
}],
],
}
]
}
運行時
sudo node-gyp rebuild
我得到這些錯誤:
make: Entering directory '/home/oleg/WebstormProjects/oresoftware/replace-line/build'
CXX(target) Release/obj.target/hello/hello.o
g++: error: unrecognized command line option ‘-std=c++1’
g++: error: unrecognized command line option ‘-stdlib=libc++’
hello.target.mk:106: recipe for target 'Release/obj.target/hello/hello.o' failed
來自錯誤跟蹤,似乎很清楚我們使用的是g ++而不是gcc,而我的g ++版本是:
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
和是的,我在Ubuntu 16.04
有誰知道爲什麼這個錯誤發生?
好的謝謝,但這裏我們談論的是g ++而不是gcc?我坦率地不知道差別 – Olegzandr
s/gcc/g ++/.... – mscdex