In C file
const uint8_t C_VAL=2;`
extern "C" const uint8_t C_VAL;
#259: constant value is not known
extern const uint8_t C_VAL;
C supports variable length arrays (since C99, but only optionally since C11. Some earlier compilers support them as a language extension), so the value of
C_VAL doesn't need to be known at the time
f2.c is compiled and so there isn't a problem.
C++ doesn't support variable length arrays (except some compilers support them as a language extension), so the value of
C_VAL must be known at the time
f2.cpp is compiled. Since it is merely declared, its value is not known and that is why the compiler shows you the quoted error. The value remains unknown until the object files of
f1.c are linked together.
Solution: Either use a language that supports VLA (such as C99), or a compiler that supports VLA as an extension (see the manual of your compiler whether it supports it, and how to enable the support) or define the array with a length that is known at compile time.