# ARM under C & C++

**URL:** <https://forums.freertos.org/t/arm-under-c-c/5305>\
**Category:** Kernel\
**Created:** [February 18, 2006, 8:46pm UTC](https://forums.freertos.org/t/arm-under-c-c/5305 "2006-02-18T20:46:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 18, 2006, 8:46pm UTC](https://forums.freertos.org/t/arm-under-c-c/5305/1 "2006-02-18T20:46:29Z")

</div>

**nobody** wrote on [Saturday, February 18, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f):

I’m trying to compile a program under FreeRTOS with IAR compiler and if I use C as language all compile without problems, but if I use embedded C++ or extended embedded C++ I obtain always the following errors:  
Error[e46]: Undefined external “AT91F\_LowLevelInit” referred in ?RESET ( C:\Empresa\  
Inicio\Debug\Obj\Cstartup.r79 )  
Error[e46]: Undefined external “vTaskSwitchContext” referred in portasm ( C:\Empresa\Inicio\  
Debug\Obj\portasm.r79 )  
Error[e46]: Undefined external “vTaskIncrementTick” referred in portasm ( C:\Empresa\  
Inicio\Debug\Obj\portasm.r79 )

I tought that FreeRTOS supports C++ programming but I’m not sure.

If FreeRTOS supports C++ someone have an example of IAR compiler settings??

I’m developing with ARM7 AT91SAM7A3.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 18, 2006, 10:43pm UTC](https://forums.freertos.org/t/arm-under-c-c/5305/2 "2006-02-18T22:43:39Z")

</div>

**nobody** wrote on [Saturday, February 18, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f/3af4):

I suspect it cannot find the functions because of C++ mangling the names.&nbsp; Try using extern "C" on the functions that are called from asm code.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 18, 2006, 11:13pm UTC](https://forums.freertos.org/t/arm-under-c-c/5305/3 "2006-02-18T23:13:52Z")

</div>

**nobody** wrote on [Saturday, February 18, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f/0c7a):

Thanks, but I think that you didn`t understand the question.  
I don’t use asm code. I have problems with C++ code.  
For example, I have depeloped a class for encapsulate the task funcionality, I can compile the project with this class without problems, but when I write code for instance this class in my main function I have errors linking the project.  
The errors are the following:  
Linking  
Error[e46]: Undefined external “xTaskCreate(pdTASK\_CODE, signed char const \*, unsigned&nbsp;  
short, void \*, unsigned long, void \* \*)” referred in ITask ( C:\Empresa\Inicio\Debug\Obj\  
ITask.r79 )  
Error[e46]: Undefined external “xTaskGetTickCount()” referred in ITask ( C:\Empresa\Inicio\  
Debug\Obj\ITask.r79 )  
Error[e46]: Undefined external “vTaskDelayUntil(portTickType \*, portTickType)” referred in&nbsp;  
ITask ( C:\Empresa\Inicio\Debug\Obj\ITask.r79 )  
Error[e46]: Undefined external “vTaskDelete(void \*)” referred in ITask ( C:\Empresa\Inicio\  
Debug\Obj\ITask.r79 )  
Error[e46]: Undefined external “vTaskStartScheduler()” referred in main ( C:\Empresa\Inicio\  
Debug\Obj\main.r79 )

Someone have any idea???  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 19, 2006, 8:42am UTC](https://forums.freertos.org/t/arm-under-c-c/5305/4 "2006-02-19T08:42:25Z")

</div>

**nobody** wrote on [Sunday, February 19, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f/0c7a/5804):

While it may not be asm related it still sounds like the same problem.&nbsp; Are you compiling some files as c++ and some as c?&nbsp; If so they will not link.&nbsp; You need to compile it all as c++ (in which case I’m not sure it will work) or declare the c code as extern “c” (in which case it may work depending on what you are doing with the c++ code).

If you are not sure what this answer means then I suggest reading up a bit on mixing c and c++.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 20, 2006, 8:23am UTC](https://forums.freertos.org/t/arm-under-c-c/5305/5 "2006-02-20T08:23:05Z")

</div>

**[jra01](https://sourceforge.net/u/jra01/)** wrote on [Monday, February 20, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f/0c7a/8e00):

Maybe the problem is that the compiler doesn’t see the extern “C” when compiling the OS, but when it compiles the c++ code. Therefore the C++ expects unmangled names, but the OS functions are mangled. Look in your link listing if you can find mangled versions of the OS functions (in case you get a listing even with failed links).

Jokke

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 20, 2006, 8:51am UTC](https://forums.freertos.org/t/arm-under-c-c/5305/6 "2006-02-20T08:51:58Z")

</div>

**[jra01](https://sourceforge.net/u/jra01/)** wrote on [Monday, February 20, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/ea716e73/#cd3f/2a31):

I also experienced in one environment, that when I set it up for c++ all the \*.c files were omitted, and not included in the make.

Jokke again
