Other Parts Discussed in Thread: C2000WARE
Hello folks,
I'm facing a similar problem. I'm starting a new project and I'd like to use the driverlib with my previous C++ code. I started importing the driverlib empty_project and when I rename the main.c to main.cpp, I'm getting this compilation errors:
>> Compilation failure
subdir_rules.mk:9: recipe for target 'driverlib_main.obj' failed
"C:/ti/c2000/C2000Ware_4_00_00_00/driverlib/f28004x/driverlib/erad.h", line 380: error #121: return value type does not match the function type
"../driverlib_main.cpp", line 58: warning #337-D: linkage specification is not allowed
At end of source: error #68: expected a "}"
2 errors detected in the compilation of "../driverlib_main.cpp".
gmake: *** [driverlib_main.obj] Error 1
gmake: Target 'all' not remade because of errors.
The compiler points to an error at this function:
static inline ERAD_Owner
ERAD_getOwnership()
{
//
// Read Global Owner register and return value
//
return((ERAD_Owner)(HWREGH(ERAD_GLOBAL_BASE + ERAD_O_GLBL_OWNER) &
ERAD_GLBL_OWNER_OWNER_M) >> ERAD_GLBL_OWNER_OWNER_S);
}
However, I have no idea how to solve it.
I've tried to use the extern "C" directive, but there was no difference, I'm still getting the same error.
extern "C"
{
#include "driverlib.h"
#include "device.h"
}
The project with the main.c compiles with no error neither warnings.
Do you guys have experience using driverlib in C++ projects? Is this a good idea?
Cheers,
Luciano