c++ - How can I fix YouCompleteMe's wrong error highlighting of "cout" usage? -


i've been trying youcompleteme set on machine, , i'm there, except small problem. when use cout simple cout << "hello world!" << endl;, ycm highlights cout, first <<, , string error, telling me: invalid operands binary expression ('ostream' (aka 'int') , 'const char *').

i know program correct. compiles , runs. causing behavior?

let me know if left out information.

thanks!

edit: .ycm_extra_conf.py file this:

import os import ycm_core  # these compilation flags used in case there's no # compilation database set (by default, 1 not set). # change list of flags. yes, droid have been looking for. flags = [ '-wall', '-stdlib=libc++', '-std=c++11', '-x', 'c++', # path work on os x, paths don't exist not # harmful '-isystem', '/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include' '-isystem', '/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/include' '-isystem', '/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/usr/include' '-isystem', '/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/system/library/frameworks' '-isystem', '/system/library/frameworks/python.framework/headers', '-isystem', '../llvm/include', '-isystem', '../llvm/tools/clang/include', '-i','.', '-i','./clangcompleter', ]  # set absolute path folder (not file!) containing # compile_commands.json file use instead of 'flags'. see here # more details: http://clang.llvm.org/docs/jsoncompilationdatabase.html # # projects not need set anything; can change # 'flags' list of compilation flags. notice ycm uses approach. compilation_database_folder = ''  if compilation_database_folder:     database = ycm_core.compilationdatabase( compilation_database_folder ) else:     database = none   def directoryofthisscript():     return os.path.dirname( os.path.abspath( __file__ ) )   def makerelativepathsinflagsabsolute( flags, working_directory ):     if not working_directory:         return list( flags )     new_flags = []     make_next_absolute = false     path_flags = [ '-isystem', '-i', '-iquote', '--sysroot=' ]     flag in flags:         new_flag = flag          if make_next_absolute:             make_next_absolute = false             if not flag.startswith( '/' ):                 new_flag = os.path.join( working_directory, flag )          path_flag in path_flags:             if flag == path_flag:                 make_next_absolute = true                 break              if flag.startswith( path_flag ):                 path = flag[ len( path_flag ): ]                 new_flag = path_flag + os.path.join( working_directory, path )                 break         if new_flag:             new_flags.append( new_flag )     return new_flags   def flagsforfile( filename ):     if database:         # bear in mind compilation_info.compiler_flags_ not return         # python list, "list-like" stringvec object         compilation_info = database.getcompilationinfoforfile( filename )         final_flags = makerelativepathsinflagsabsolute(compilation_info.compiler_flags_, compilation_info.compiler_working_dir_ )     else:         # relative_to = directoryofthisscript()         relative_to = os.path.dirname(os.path.abspath(filename))         final_flags = makerelativepathsinflagsabsolute( flags, relative_to )      return {         'flags': final_flags,         'do_cache': true     } 

i forgot commas on end of lines telling ycm find libraries. corrected flags read:

flags = [ '-wall', '-stdlib=libc++', '-std=c++11', '-x', 'c++', #'-x', 'c++-header' # path work on os x, paths don't exist not # harmful '-isystem', '/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include', '-isystem', '/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/include', '-isystem', '/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/usr/include', '-isystem', '/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/system/library/frameworks', '-isystem', '/system/library/frameworks/python.framework/headers', '-isystem', '../llvm/include', '-isystem', '../llvm/tools/clang/include', '-i','.', '-i','./clangcompleter', ] 

anyways, learned lot of googling did, it's not complete loss. tried help!


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -