search

Home  >  Q&A  >  body text

node-gyp - 如何在mac设置C++路径

  CXX(target) Release/obj.target/addon/main.o
../main.cpp:6:10: fatal error: 'opencv2/opencv.hpp' file not found
#include <opencv2/opencv.hpp>
         ^
1 error generated.
make: *** [Release/obj.target/addon/main.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "build"
gyp ERR! cwd /Users/CoderQ/beautiful/bookshelf/gyp/gyp
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

我node-gyp configure成功,再执行node-gyp rebuild时 出现这个问题 但是/usr/local/include是有这个文件的,我觉得应该是哪个path没设置正确,但我就是不知道到底要设置什么path

PHP中文网PHP中文网2807 days ago571

reply all(3)I'll reply

  • PHPz

    PHPz2017-04-17 13:25:41

    Generally, /usr/include is searched. Otherwise, check whether your /usr/include exists. If it does not exist, try soft linking /usr/local/include to /usr/include.

    reply
    0
  • 迷茫

    迷茫2017-04-17 13:25:41

    It’s because you didn’t compile the import path when you installed opencv.

    reply
    0
  • PHPz

    PHPz2017-04-17 13:25:41

    'include_dirs': [
              '/usr/local/include',
            ],

    "targets".'link_settings'.'include_dirs' = '/usr/local/include'
    I found a way to add this definition to building.gyp, but here comes another 'cstdint' file not found

    reply
    0
  • Cancelreply