Clion cannot recognize cpp file when edit

Clion cannot recognize the cpp file; the icon for the file is unusual. Also, when editing, the variable names and function names are not highlighted.

However, debugging works fine, and the file can be complied. It worked before, and I didn't change anything. Even when I create a new project, it still doesn't do any highlighting. How can I fix that? Thanks a lot.

0

Hi! Is your project CMake-based? Is this file added to any target? Does Tools | CMake | Reset Cache and Reload Project helps? Is the problem actual for all .cpp files or just for this one? Do you have *.cpp in File | Settings | Editor | File Types for C/C++?

0
Avatar
Permanently deleted user

hello and thank you for your answer.

-Does Tools | CMake | Reset Cache and Reload Project helps?

I tried but unfortunately it didn't help.

-Do you have *.cpp in File | Settings | Editor | File Types for C/C++? 

yes.

-Is the problem actual for all .cpp files or just for this one?

iv'e opened several projects, all of them had the same problem with the .cpp file.

-Is your project CMake-based?

-Is this file added to any target?

how can i check it ? Perhaps the answer to one of these questions may help me.

 

once again thank you for your help!

0

1. Do you have CMakeLists.txt file in your project? Is the file added to any target (specified in add_executable/add_library command)?

2. Please do File | Invalidate Caches / Restart. Does it help?

3. In CLion please do File | New Project > choose C++ Executable > Create. Wait till the CMake project loads and indexing finishes. Does main.cpp have the same problem?

0

请先登录再写评论。