Hi,
I'm a beginner on MCU programming (STM32F4 discovery)
I'm building my code on C language. Recently, i find some library in C++ can achieved my job. However, when i compile it, errors occurred.
"#20: identifier "namespace" is undefined _RWSTD_NAMESPACE_BEGIN (__rw) "#65: expected a ";" ......
I think the issue comes from the compiler is C compiler which cannot compile C++ code.
How can i do with this case ?
Thank you.
You can either: 1. change the extension of your file to .cpp - if it does not mix C and C++. 2. Right click on the file name / logical folder to select the compiler to use. 3. Only use C++ file extensions throughout the entire project. 4. Use the preprocessor but I would not recommend that at all.
Not quite.
The compiler can compile 'C' and C++
www.keil.com/.../armcc_chr1359124192674.htm
Usually, the compiler decides automatically from the filename extension: .c files will be compiled as 'C'; .cpp files will be compiled as C++.
Or you can force it explicitly by specifying options.
In general, if you want to use any C++ code, it's usually easiest to make your whole project C++.
In most cases, 'C' source code will "just work" when compiled as C++.
"I'm a beginner on MCU programming"
The above is entirely general - nothing specific to microcontrollers or Keil or ARM.
I think you need to Change the extension of your file to .cpp - if it does not mix C and C++.
crbtech.in/online-java-training-course
Use one of the following notations to declare that an object or function has the linkage of language language_name:
extern “<i>language_name" declaration</i> ;
extern “<i>language_name</i>“ { <i>declaration ; declaration </i>; ... }
The first notation indicates that the declaration (or definition) that immediately follows has the linkage of language_name. The second notation indicates that everything between the curly braces has the linkage of language_name, unless declared otherwise. Notice that you do not use a semicolon after the closing curly brace in the second notation.
java training institute in hyderabad