[英]YouCompleteMe and C++ diagnostics inappropriate errors
我正在嘗試讓YCM在Vim中進行C ++開發。 我正在使用JUCE框架。 Ctags和自動補全效果很好。 但是,我在“裝訂線”中看到很多錯誤的錯誤,如紅色箭頭所示。
例如
no matching member function for call to 'addAndMakeVisible'
當addAndMakeVisible
是繼承的類Component
的函數,甚至出現在自動完成中時。
還出現很多類似以下的錯誤:
cannot initialize object parameter of type 'juce::Component' with an expression of type 'MyComponent'
我的.ycm_extra_conf.py
: https : .ycm_extra_conf.py
我正在添加具有絕對路徑以及本地項目版本的JUCE庫,並復制@ladislas示例中的建議。
:YCMDebugInfo的輸出https://gist.github.com/adamski/2e7dd79b45d0fb6f5010#file-ycmdebuginfo
:YCMDiags的當前輸出https://gist.github.com/adamski/8fad8e0724a03854912b
重新出現問題的示例存儲庫: https : //github.com/adamski/juce-chapter02-07
我的.vimrc
看起來像:
"" YouCompleteMe options
"
let g:ycm_register_as_syntastic_checker = 0 "default 1
"let g:Show_diagnostics_ui = 1 "default 1
"
""will put icons in Vim's gutter on lines that have a diagnostic set.
"Turning this off will also turn off the YcmErrorLine and YcmWarningLine
""highlighting
set tags=./tags,tags;
set autochdir
let g:ycm_enable_diagnostic_signs = 1
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_always_populate_location_list = 1 "default 0
let g:ycm_open_loclist_on_ycm_diags = 1 "default 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_complete_in_strings = 1 "default 1
let g:ycm_collect_identifiers_from_tags_files = 1 "default 0
let g:ycm_path_to_python_interpreter = '' "default ''
let g:ycm_server_use_vim_stdout = 0 "default 0 (logging to console)
let g:ycm_server_log_level = 'info' "default info
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' "where to search for .ycm_extra_conf.py if not found
let g:ycm_confirm_extra_conf = 1
let g:ycm_goto_buffer_command = 'same-buffer' "[ 'same-buffer', 'horizontal-split', 'vertical-split', 'new-tab' ]
let g:ycm_filetype_whitelist = { '*': 1 }
let g:ycm_key_invoke_completion = '<C-Space>'
nnoremap <F11> :YcmForceCompileAndDiagnostics <CR>
正如@FDinoff指出的那樣,每個.ycm_extra_conf.py
需要針對其自己的項目進行量身定制。
為了給您一個可能對您有所幫助的示例,這是我的: .ycm_extra_conf.py
因為我將所有庫都放在項目根目錄的./lib
目錄中,所以我制作了一個./lib
自動掃描目錄並將庫添加為標志。
您可以閱讀第57行 :
for path, dirs, files in os.walk(libDir):
for d in dirs:
flag = '-I' + os.path.join(path, d)
flags.append(flag)
libDir
被定義為第4行
這是原始項目: Moti
編輯-2014年2月2日-
我在樹輸出.ycm_extra_conf.py
不到.ycm_extra_conf.py
。 該文件應位於項目的根目錄。
您也可以嘗試對標志使用絕對路徑。
:YcmDebugInfo
的輸出應如下所示: http :YcmDebugInfo
您可以在配置YCM的地方檢查.vimrc
: 鏈接到YCM Conf 。 嘗試在沒有您的情況下使用我的,看看會發生什么。
對我來說,YouCompleteMe可以與JUCE一起很好地工作,而不會出現您所描述的錯誤。
我已經將.ycm_extra_conf.py從我當前的項目復制到了您的開源前身,在這里YCM也可以正常工作。
從https://github.com/klangfreund/LUFSMeter獲取。 YCM可以按預期運行(項目有問題)或沒有按預期運行(YCM安裝有問題)。
我將XCode更新安裝到6.11,現在看來它可以按預期工作。 感謝@ladislas和@Samuel Gaehwiler的幫助和指導。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.