search

Home  >  Q&A  >  body text

c++ - mac系统下用带YouCompleteMe插件的vim编写cpp程序报错

黄色三角形显示:expression result unused;
红色叉叉显示:reference to overloaded function could not be resolved;did you mean to call it?

下面是我的.ycm_extra_conf.py配置

PHP中文网PHP中文网2767 days ago678

reply all(2)I'll reply

  • 阿神

    阿神2017-04-17 13:01:42

    I'm sorry that I found the wrong header file location. I shouldn't use the Internet to help you prepare it or use the default one. You still have to prepare the specific header file location yourself!
    Replace the fifth line from the bottom with the following
    '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include'

    reply
    0
  • 迷茫

    迷茫2017-04-17 13:01:42

    Run echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ - to find the system header file and add it to -isystem. If you use homebrew to install various packages, you also need to add include to -isystem, which should be '/usr/local/include',.
    My ycm_config looks like this

     53 'c++',
     54 '-isystem', #Mark as system header
     55 #Using `echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -` to generate the following infos
     56 '/usr/local/include',
     57 '-isystem',
     58 '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1',
     59 '-isystem',
     60 '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include',
     61 '-isystem',
     62 '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
     63 '-isystem',
     64 '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include',
     65 '-isystem',
     66 '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks',

    reply
    0
  • Cancelreply