ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.46k stars 2.81k forks source link

use of undeclared identifier 'glm'; did you mean 'std::glm'? #3077

Closed nitronoid closed 6 years ago

nitronoid commented 6 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key questions:

Tried to use glm with in a c++ project. However ycm reports that the namespace should be std::glm. 'use of undeclared identifier 'glm'; did you mean 'std::glm'?'

include "vec3.hpp"

int main() { glm::vec3 x; return 0; }

glm should have been recognised as the root namespace.

Include description of the observed behaviour, including actual output, screenshots, etc.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 4 2018 12:29:41) Included patches: 1-119, 121 Modified by bugzilla@redhat.com Compiled by bugzilla@redhat.com Huge version without GUI. Features included (+) or not (-): +acl +farsi +mouse_sgr -tag_any_white +arabic +file_in_path -mouse_sysmouse -tcl +autocmd +find_in_path +mouse_urxvt +termguicolors -autoservername +float +mouse_xterm +terminal -balloon_eval +folding +multi_byte +terminfo +balloon_eval_term -footer +multi_lang +termresponse -browse +fork() -mzscheme +textobjects ++builtin_terms +gettext +netbeans_intg +timers +byte_offset -hangul_input +num64 +title +channel +iconv +packages -toolbar +cindent +insert_expand +path_extra +user_commands -clientserver +job +perl/dyn +vartabs -clipboard +jumplist +persistent_undo +vertsplit +cmdline_compl +keymap +postscript +virtualedit +cmdline_hist +lambda +printer +visual +cmdline_info +langmap +profile +visualextra +comments +libcall +python/dyn +viminfo +conceal +linebreak +python3/dyn +vreplace +cryptv +lispindent +quickfix +wildignore +cscope +listcmds +reltime +wildmenu +cursorbind +localmap +rightleft +windows +cursorshape +lua/dyn +ruby/dyn +writebackup +dialog_con +menu +scrollbind -X11 +diff +mksession +signs -xfontset +digraphs +modify_fname +smartindent -xim -dnd +mouse +startuptime -xpm -ebcdic -mouseshape +statusline -xsmp +emacs_tags +mouse_dec -sun_workshop -xterm_clipboard +eval +mouse_gpm +syntax -xterm_save +ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/etc" f-b for $VIMRUNTIME: "/usr/share/vim/vim81" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/python3.6m -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim -lm -lselinux -lncurses -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc

Output of YcmDebugInfo

Printing YouCompleteMe debug information... -- Client logfile: /tmp/ycm_8vrSCl.log -- Server Python interpreter: /usr/bin/python -- Server Python version: 2.7.15 -- Server has Clang support compiled in: True -- Clang version: clang version 6.0.0 (tags/RELEASE_600/final) -- Extra configuration file found and loaded -- Extra configuration path: /home/nitronoid/Documents/cpp/pathtracer/.ycm_extra_conf.py -- C-family completer debug information: -- Compilation database path: None -- Flags: [u'-x', u'c++', u'-DQT_CORE_LIB', u'-DQT_GUI_LIB', u'-DQT_NO_DEBUG', u'-D_GLIBCXX_PARALLEL', u'-D_REENTRANT', u'-I/home/nitronoid/Documents/cpp/pathtracer/.', u'-I/home/nitronoid/Documents/cpp/pathtr acer', u'-I/home/nitronoid/Documents/cpp/pathtracer/include', u'-I/usr/lib64/qt5/mkspecs/linux-clang', u'-W', u'-Wall', u'-std=c++17', u'-isystem', u'/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../include /c++/8', u'-isystem', u'/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux', u'-isystem', u'/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward', u'- isystem', u'/usr/local/include', u'-isystem', u'/usr/lib64/clang/6.0.0/include', u'-isystem', u'/usr/include', u'-isystem', u'/usr/include/libdrm', u'-isystem', u'/usr/include/qt5', u'-isystem', u'/usr/include/q t5/QtCore', u'-isystem', u'/usr/include/qt5/QtGui', u'-isystem', u'/usr/local/include/glm/glm', u'-isystem', u'/usr/local/include/glm', u'-isystem', u'/usr/local/include', u'-resource-dir=/home/nitronoid/.vim/bu ndle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', u'-fspell-checking'] -- Translation unit: /home/nitronoid/Documents/cpp/pathtracer/src/main.cpp -- Server running at: http://127.0.0.1:36911 -- Server process ID: 24286 -- Server logfiles: -- /tmp/ycmd_36911_stdout_x4pPjT.log -- /tmp/ycmd_36911_stderr_OmFSLa.log

OS version, distribution, etc.

Operating System: Fedora 28 (Workstation Edition) CPE OS Name: cpe:/o:fedoraproject:fedora:28 Kernel: Linux 4.17.4-200.fc28.x86_64 Architecture: x86-64

puremourning commented 6 years ago

Thanks for the complete report. What’s the output of :YcmDiags?

nitronoid commented 6 years ago

Ah /usr/include/c++/8/parallel/base.h|37 col 10 error| 'omp.h' file not found
/usr/include/c++/8/parallel/tags.h|36 col 10 error| 'omp.h' file not found /usr/include/c++/8/parallel/tags.h|66 col 18 error| use of undeclared identifier 'omp_get_max_threads' /usr/include/c++/8/parallel/base.h|87 col 24 error| use of undeclared identifier 'omp_get_max_threads' /usr/include/c++/8/parallel/find.h|111 col 7 error| unknown type name 'omp_lock_t' /usr/include/c++/8/parallel/find.h|119 col 20 error| use of undeclared identifier 'omp_get_num_threads' /usr/include/c++/8/parallel/find.h|124 col 23 error| use of undeclared identifier 'omp_get_thread_num' /usr/include/c++/8/parallel/find.h|216 col 7 error| unknown type name 'omp_lock_t' /usr/include/c++/8/parallel/find.h|225 col 18 error| use of undeclared identifier 'omp_get_num_threads' /usr/include/c++/8/parallel/find.h|228 col 23 error| use of undeclared identifier 'omp_get_thread_num' /usr/include/c++/8/parallel/find.h|340 col 7 error| unknown type name 'omp_lock_t' /usr/include/c++/8/parallel/find.h|349 col 18 error| use of undeclared identifier 'omp_get_num_threads' /usr/include/c++/8/parallel/find.h|351 col 23 error| use of undeclared identifier 'omp_get_thread_num' /usr/include/c++/8/bits/char_traits.h|304 col 9 error| no matching function for call to 'constant_char_array_p' /usr/include/c++/8/bits/char_traits.h|305 col 9 error| no matching function for call to 'constant_char_array_p' /usr/include/c++/8/bits/char_traits.h|317 col 6 error| no matching function for call to '__constant_string_p' /usr/include/c++/8/bits/char_traits.h|329 col 9 error| no matching function for call to 'constant_char_array_p' /usr/include/c++/8/bits/char_traits.h|413 col 9 error| no matching function for call to 'constant_char_array_p' /usr/include/c++/8/bits/char_traits.h|414 col 9 error| no matching function for call to '__constant_char_array_p' src/main.cpp|11 col 54 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|21 col 3 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|22 col 3 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|23 col 3 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|26 col 22 error| unknown type name 'Sphere' src/main.cpp|26 col 45 error| unknown type name 'Ray' src/main.cpp|30 col 18 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|31 col 24 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|33 col 18 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|38 col 1 error| use of undeclared identifier 'glm'; did you mean 'std::glm'? (FixIt available) src/main.cpp|38 col 17 error| unknown type name 'Ray'

Seems to have trouble finding open mp, but also my classes defined in "./include"

puremourning commented 6 years ago

This indicates a problem with your compile flags. Basically libclang can’t parse your code with those flags.

nitronoid commented 6 years ago

ah i see, i'll try fix that, thanks for your help

nitronoid commented 6 years ago

Solved it by removing all of the flags beginning with -D, they don't have much of an effect on the syntax highlighting anyway.