Harvey White

"class" keyword not recognized by compiler in C++ project. 

Discussion created by Harvey White on Mar 10, 2017
Latest reply on Mar 16, 2017 by AvaTar

I'm migrating a moderately large C++/C project from Xmegas to ARM.  Got a nucleo-64 F446 board, wrote a strictly C program, know how to set the chip up, make a project. 


AC6 seems not to be happy with linked files, to eliminate that, all the .c and .cpp files are in the /src, all of the .h files are in .inc.

Went through as much as I could for compiler differences, however, the latest problem is that the compiler/linker does not see (undefined reference) to methods in C++.  Editor sees the file, paths added for both the C and C++ compiler, but it's as if the linker can't find it regardless of where it is.  Also get "class" is not a recognized keyword.  Adding extern "C" or extern "C++" doesn't work since the compiler insists that this is not a valid syntax.  Renaming .h file to .hpp file identifies file as C++ header, but that apparently doesn't impress the compiler.


I can't go through and change all the C++ code to C, there's way too much that actually uses classes (all sorts of graphics objects and a lot of the drivers are structured that way.)  I don't mind rewriting the drivers, that's relatively easy and in theory, got that to work, but the rest of the routines don't play nice, generally, the C++ routines.  Already converted the project to a C++ project, and got some syntax errors from the compiler (fixed).....


Any suggestions?