niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4
https://niosus.github.io/EasyClangComplete/
MIT License
575 stars 78 forks source link

Headers from listed add_definitions are not getting included and pch breaks completion #750

Closed dortamiguel closed 3 years ago

dortamiguel commented 3 years ago

Fill the gaps below this line and remove all text above it


System info:

What happens:

On my cmake I have a global hpp include like this

add_definitions(-include global.hpp)

This global.hpp has #include <string> and clang compiles fine files that are using std::string whitout being explicit about this include.

I know this is not a good practice but the plan is to setup a pch, for the moment, there is any way of forcing a global include on EasyClangComplete?

image

Also it seems like the plugin stops working when adding a pch in the CMakeLists.txt with target_precompile_headers, I get the following message in the console when using this

[ECC:ERROR  ]: error while compiling: Error parsing translation unit.
[ECC:CRITICAL]:  cannot create translation unit. Abort.
dortamiguel commented 3 years ago

I realised you can use .clang_complete file in the root folder to add include folders