Dealing with C++ template implementation files (.ipp, .tcc, ...)

1,308 views
Skip to first unread message

Nik Melchior

unread,
Nov 7, 2014, 3:06:56 PM11/7/14
to ycm-...@googlegroups.com
I think it is common C++ practice to place class template declarations and definitions in separate files, and the definition file is usually named *.ipp or *.tcc or similar.  Since the definitions are always needed by the compiler along with the declarations, the *.ipp files are included from the header (*.h) files.  When editing a *.ipp file in vim, though, YCM has no way to know that it should start parsing with the header file, so it detects many compilation errors.  The filetype is "cpp", just like any other C++ file, so I don't think that can be used to distinguish between them.  Has anyone else dealt with this problem?

Priyank Patel

unread,
Feb 4, 2019, 4:06:20 PM2/4/19
to ycm-users
Hello, 
I have similar problem. I have just started using YCM recently. Have you managed to solve this?
Thanks

Boris Staletic

unread,
Feb 5, 2019, 12:56:09 AM2/5/19
to Priyank Patel, ycm-users
YCM has a way to deal with this. The dictionary returned from the extra conf file can contain an optional entry with the key named "override_filename", which tells YCM to parse a file as some other file. Search the GitHub issues for examples.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Priyank Patel

unread,
Feb 5, 2019, 9:23:40 AM2/5/19
to ycm-users
Thank you very much! I will try it out. 
Reply all
Reply to author
Forward
0 new messages