Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete types detected by YCM #1763

Closed
robertsawko opened this issue Nov 10, 2015 · 7 comments
Closed

Incomplete types detected by YCM #1763

robertsawko opened this issue Nov 10, 2015 · 7 comments

Comments

@robertsawko
Copy link

Hello,

I am working again with YCM developing an application for library called OpenFOAM. The project ycm file as well as the project are here. The YCM file works by using environmental variables to include the correct directories. Completion and detecting errors mostly works, but I have a few that I cannot quite nail down and I was wondering if I can ask for your input.

I get two errors:

error: 'SomeType' does not refer to a value
error: incomplete type 'SomeTemplatedType' named in nested name specifier

I think they are related as it's all about templated types or types that I pass as template arguments. None of this errors appears in the compilation. I tried using -include switch in .ycm_extra_conf.py to include the file containing the templated class explicitly but that didn't resolve it.

As far as I can see I am putting exactly the same options and includes to my cmake and to YCM, so I feel that the difference must be more subtle.

Also, the typdef was not deteted until I included the file containing them explicitly

    '-include ' + foam_src + '/finiteVolume/lnInclude/volFieldsFwd.H'

This may or may not be related. Another little thing that may be going on here is that OpenFOAM uses environmental variables to instantiate some template classes. For instance Vector can be float or double depending on the type of compilation specified in the environment.

@micbou
Copy link
Collaborator

micbou commented Nov 11, 2015

There are missing commas in your .ycm_extra_conf.py file at end of lines 50 and 75. You can use the command :YcmDebugInfo to check if the flags are correctly set.

robertsawko pushed a commit to robertsawko/STFFoam that referenced this issue Nov 11, 2015
@robertsawko
Copy link
Author

Yes, you're right, but I must have introduced that when I was playing around. I've just fixed and the incomplete types are still there.

I've compared the flags from :YcmDebugInfo with my make VERBOSE=1 before and I can't spot the difference. If you could have a look at it independently, perhaps it will help:

From YCM

-- Flags for /home/c111269/projects/stffoam2/src/translationalFrame.C loaded from /home/c111269/projects/stffoam2/.ycm_extra_conf.py:                          
-- ['-DSTF_EXPORTS', '-m64', '-Dlinux64', '-DWM_ARCH_OPTION=64', '-DWM_DP', '-DWM_LABEL_SIZE=32', '-std=c++11', '-Wno-unused-local-typedefs', '-Wall', '-Wextra
', '-Wno-unused-parameter', '-Wold-style-cast', '-Wnon-virtual-dtor', '-Wno-unused-variable', '-std=c++11', '-x', 'c++', '-I/home/c111269/OpenFOAM/OpenFOAM-3.0
.0/src/fvOptions/lnInclude', '-I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/finiteVolume/lnInclude', '-I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/meshTools/lnInc
lude', '-I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/OpenFOAM/lnInclude', '-I/home/c111269/projects/stffoam2/./src/', '-I/home/c111269/projects/stffoam2/.', '-I
/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/OSspecific/POSIX/lnInclude', '-include /home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/OpenFOAM/lnInclude/Vector.H', '-incl
ude /home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/finiteVolume/lnInclude/volFieldsFwd.H', '-isystem', '/home/c111269/.vim/bundle/YCM/third_party/ycmd/ycmd/../clang
_includes']

From cmake/make

cd /home/c111269/projects/stffoam2/build/src && /usr/bin/c++   -DSTF_EXPORTS -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -std=c++11 -Wno-unus
ed-local-typedefs -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-variable -O3 -DNoRepository -ftemplate-depth-100 -fPIC -X
linker --add-needed -Xlinker --no-as-needed -fPIC -I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/fvOptions/lnInclude -I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/f
initeVolume/lnInclude -I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/meshTools/lnInclude -I/home/c111269/OpenFOAM/OpenFOAM-3.0.0/src/OpenFOAM/lnInclude -I/home/c1
11269/OpenFOAM/OpenFOAM-3.0.0/src/OSspecific/POSIX/lnInclude    -o CMakeFiles/STF.dir/translationalFrame.C.o -c /home/c111269/projects/stffoam2/src/translationalFrame.C```

@micbou
Copy link
Collaborator

micbou commented Nov 11, 2015

Did you try to add the -DNoRepository flag? It seems to work for me.

robertsawko pushed a commit to robertsawko/STFFoam that referenced this issue Nov 12, 2015
@robertsawko
Copy link
Author

Thanks for the suggestion. It has changed things but it isn't working for me, unfortunately.

I still get incomplete types for Foam::wordList and the function completion doesn't work. Also I am now getting no member named 'translationalFrame' in namespace 'Foam which is defined in included translationalFrame.H in the very same directory as the C file.

Should I be using -include flag at all?

@micbou
Copy link
Collaborator

micbou commented Nov 12, 2015

No, you need to remove them. With those flags, I am getting the same errors that you are experiencing.

@robertsawko
Copy link
Author

"It is alive!"

Thanks ever so much. That will help me a lot.

@peter-duanyu
Copy link

Did you finally resolve this problem? I got the same problem when I opened OpenFOAM.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants