Clion reports _Static_assert as error (cant resolve symbol) in C files (but works in cpp files)

_Static_assert is not recognized by clion and reports an error


_static_assert is a symbol in C++11 new features,so it can only work in cpp(the compiler must support c++11 standard),but does not work in pure c files.


of course CLion supports C++11 new features,but pay attention,that is C++ 11.C++,see?so the compiler does support the new features but if you create a new file of c type(*.c,not *.cpp),the type of the file,C,does not support what type Cpp can support(here,C++11 new features).
So it reported the error.To fix this,you should use _static_assert in cpp files,not use it in c files.


_Static_assert is a C11 feature, whereas static_assert is a C++11 feature. Will Clion support _Static_assert in C11 soon?


Please sign in to leave a comment.