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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
927 次查看
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 项奖励
1 解答
659 次查看
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

在原帖中查看解决方案

0 项奖励
2 回复数
659 次查看
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

660 次查看
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

0 项奖励