HI,
i am working on porting some proj into esp-idf environment where C++ class and namespaces are declared in ".h" file instead of ".hpp",
xtensa-32 compiler throws error saying that could not find "namespace" and could not find "class" error.
i could not see any option to force the compiler to cosider it as C++ header file during compilation.
regards
jotman01
Xtensa compiler considering the ".h" file as C header file?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Xtensa compiler considering the ".h" file as C header file?
The compiler will not try to interpret .h/.hpp files by itself; it will only include it if a .c/.cpp file has an include directive for it. As .c files are compiled with the C compiler and .cpp files are compiled with the C++ compiler, a .h file included in a .c file will also be compiled by the C compiler and will error out. The solution here is to not include any c++-specific structures in headers that are going to be included in plain .c files, and/or converting any .c files that do need to include headers that have C++ structures in them to .cpp files.
Who is online
Users browsing this forum: Bing [Bot] and 81 guests