How to configure processor expert project for C++ in KDS 3.2 ?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure processor expert project for C++ in KDS 3.2 ?

Jump to solution
508 Views
kirtiraje
Contributor III

Hello,

I am trying to create C++ project with processor expert bean in KDS 3.2  and KSDK 1.3. I am using MK64FN controller with processor expert enabled. I have gone through following links  for C++ settings.

Processor Expert, gcc C++ and Kinetis-L with MQXLite | MCU on Eclipse 

C++ with Kinetis Design Studio | MCU on Eclipse  

I would like to know , from where to add "${MCUToolsBaseDir}/ARM_GCC_Support/ewl/EWL_C/include" these library files in my project. Also, searching for linker flags on Linker Miscellaneous page. I have tried to add below flages as given in above link but I am getting an error as undefined  lc++.

--undefined=__pformatter_
--defsym=__pformatter=__pformatter_
--start-group
-lc++ -lrt -lsupc++ -lc -lgcc -luart
--end-group
I am getting following error after building the project.
c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/crt0.o: In function `_start':
(.text+0x4a): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
makefile:71: recipe for target 'Test_cpp.elf' failed.
Can any one help me in how to add C++ files to my project and compile the project.
Thanks,
Kirti
0 Kudos
1 Solution
240 Views
kirtiraje
Contributor III

Hi Erich,

Thanks for the reply. It is working now. 

I have renamed the main.c file to main.cpp and added following code to header file. Then called mainApp() function in main.cpp file. 

#ifdef __cplusplus
extern "C"
void mainApp(void);
#endif

Kirti

View solution in original post

0 Kudos
2 Replies
240 Views
BlackNight
NXP Employee
NXP Employee

Hi Kiri,

It seems to me that you have compiled the file with main() in C++ mode. _start() expects main() with C calling convention.

So make sure you are using 'extern "C"' for the main() function, then you will be able to link it.

I hope this helps,

Erich

241 Views
kirtiraje
Contributor III

Hi Erich,

Thanks for the reply. It is working now. 

I have renamed the main.c file to main.cpp and added following code to header file. Then called mainApp() function in main.cpp file. 

#ifdef __cplusplus
extern "C"
void mainApp(void);
#endif

Kirti

View solution in original post

0 Kudos