CLion reports errors for some methods and overloaded operators, despite compiling correctly
CLion 2018.2 seems to be reporting some of my source code as errors - namely in some interactions with the glm library - despite these errors not occurring during compilation. It seems that it does not realize these methods exist, as if it is not fully resolving all of the includes required to find these methods.
For example, any calls to glm::rotate (glm::mat4, float, glm::vec3) result in a red underline and the "No matching function" message. Despite this, the program compiles and runs correctly without so much as a warning from my compiler. The same happens for glm::cross (glm::vec3, glm::vec3). It also reports an error when I attempt to multiply a float with a glm::vec3 (an overloaded operator for this purpose is defined and valid), with the message "binary operator '*' can't be applied to expressions of type 'float' and 'glm::vec3'.
My compiler is MinGW 64-bit via MSYS2, and my toolchain is set up like so:
How do I make CLion's error checking actually match up with what my compiler interprets as an error?
Please sign in to leave a comment.
Hi! We have related issues in our tracker: https://youtrack.jetbrains.com/issue/CPP-11517, https://youtrack.jetbrains.com/issue/CPP-1894. Feel free to comment or upvote them.
You can try enabling options in `File | Settings | Languages & Frameworks | C/C++ | Clangd`. However mind there is an issue that we are gonna address in the upcoming updates – CPP-13704. More details can be found in our blog post.
Hi, an update: shortly after posting this, I found that the clangd-based clang-tidy messages (I've forgotten the exact setting name) resulted in the correct behavior, but the tradeoff was unbelievably slow launch times and random hang-ups while using the program - I essentially have to wait a few minutes whenever I want to create a new file or refactor any tiny thing.
In order to investigate performance issues, we need additional information: CPU snapshot if you manage to capture it or, in case of complete freeze, some thread dumps along with zipped contents of logs folder (
Help| Show Log in …
). Please send them to clion-support at jetbrains.com. Note that logs might contain private user's information (like file paths and names).