HELP - CLion identifying nonsense/nonexistent code problems

Hello All,

I've run into a very frustrating issue. Out of nowhere, my editor has started identifying problems and errors that simply do not exist on all of my cpp files. The errors and warnings are the same for all of my cpp files. I get no errors on any of my headers. I also cannot build the project in CLion due to these errors.

  • Firstly, it gives an error of 'Expected '}'' on the last line of every file.
  • Second, if my file has more than one #include, then every single include after the first is marked with an error of ‘Embedding a #include directive within macro arguments is not supported’
  • Finally, if I have any #if/else statements in my code,  get a warning of ‘embedding a directive within macro arguments has undefined behavior’

So far in order to remedy the issue I have;

  • Throughly checked the code in all files
  • Rolled back all changes to the previous time I successfully built the project
  • Restarted CLion
  • Restarted my computer
  • Deleted the .idea folder and restarted CLion
  • Invalidated caches and restarted
  • Every combination of the above 4 points
  • Reinstalled CLion

I also opened the project up in VSCode. I got none of these errors and the project built perfectly without any warnings (Other than an unused variable). I'm on MacOS 13.2.1 using the latest version of CLion. I've been using CLion for a few weeks now and this has not been an issue before. Any help would be hugely appreciated!

Update: I've opened other projects using the same dependencies with very similar code, as well as projects that have nothing to do with what I'm currently working on. This seems to be happing to this current project.

Update 2: I switched over to the release profile and it worked fine. But using debug failed. I then deleted the debug profile, saved, then created it with the default settings. This did not fix the issue. So for some reason even with a fresh install of CLion, these problems are specific to this project, using only the debug profile. Even tho I have other projects with basically the same code and the same cmake profiles.

1 comment


Please do Tools | CMake | Reset Cache and Reload Project and provide the entire output from the “Debug” tab of the CMake tool window.


Please sign in to leave a comment.