搜尋

首頁  >  問答  >  主體

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中文网2803 天前697

全部回覆(2)我來回復

  • 阿神

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

    不好意思自己的頭文件位置找錯了,不應該用網上幫你配製或者是默認的,具體的頭文件位置還是要自己配製!
    倒數第五行替換換成下列
    '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include'

    回覆
    0
  • 迷茫

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

    運行 echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ - 找到系統的頭文件,加入-isystem裡面。如果你用了homebrew安裝了各種包包的話,也需要把include加入-isystem裡面,應該是'/usr/local/include',
    我的ycm_config裡面是這樣的

     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',

    回覆
    0
  • 取消回覆