How to enable syntax error detection for C in CLions?
Answered
I'm very new to both C and CLions. I want the red error lines to appear when typing, but currently it looks like this.
I can't get the red lines to appear under these clearly invalid syntaxes. I've also tried this support site :https://www.jetbrains.com/help/clion/configuring-inspection-severities.html
but it doesn't contain what I need.
Please sign in to leave a comment.
Hello!
On what build system is your project based? How did you create it? How did you open it in CLion?
My system is the current Windows 10. I pulled this from a git repository by cloning the git file into my files, then opening with CLions using "Open file" then navigating to the file.
For code insight features to work CLion requires a project model to be properly loaded. In other words, smart code features doesn't work for a separately open file. They work for projects of one of the following formats: https://www.jetbrains.com/help/clion/project-models.html
The easiest way to start is the following: `File | Close Project`, select `New Project` on the Welcome screen > `C++ Executable` > `Create`. After that you can copy the necessary code and past it into this project. Or you can past your .сpp files into the created project's folder and add them to the target in the CMakeLists.txt (https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html#addtargets-reload).
I'm not sure I understand what to do for the last part. There is lots of files so it won't be possible to copy paste, and I also need it to be in the same git file since I need to commit and push it back to git.
The link doesn't tell me what to do in the case that I already have files. I want to just enable syntax checker in this folder rather than create a new one.
>I want to just enable syntax checker in this folder
There is no way to do that. As I told you already, code insight features work properly only if the project model is properly configured. For now, only CMake, Makefile, Compilation Database and Gradle are supported.
On what build system is your project based?
I too am having this same issue as well. I am on a windows 10 build and I opened an existing project with CMakeList.txt. However, I am unable to view syntax errors.
Lando Shepherd please do `Tools | CMake | Reset Cache and Reload Project`. Do you see any errors in the CMake tool window?