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

3
4 comments
Avatar
Permanently deleted user

_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.

-1
Avatar
Permanently deleted user

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.

-1
Avatar
Permanently deleted user

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

1

Please sign in to leave a comment.