11 years, 8 months ago.

identifier "class" is undefined -- compiling C++ as C?

The compiler is spitting out a long list of errors, all of which would occur if a C++ file were compiled as if it were C. Files causing errors are all of my cpp header files, all the mbed header files. E.g.,

identifier "x" undefined

...where x is namespace or class. There are other errors. #20, 757, 169, and associated parsing issues like #65

The code used to compile (months ago, am just returning to it after a hiatus). It has mixed *.c and *.cpp has anything changed that maybe would force C compilation for .c files versus before where everything was compiled as C++ ?

Thanks,

Michael

1 Answer

11 years, 8 months ago.

It is exactly what you said, the compiler was changed several months ago to compile every C file as a C file, while in the past it compiled them as C++. Most libraries should have been updated, so you can simply update them in your project. For your own files the easiest solution is renaming every .c file to .cpp, then it compiles them again as before.

Accepted Answer

Et voila, that did it, thank you!

posted by Michael Shimniok 26 Feb 2013