# Porting some C++ code to FreeRTOS

**URL:** <https://forums.freertos.org/t/porting-some-c-code-to-freertos/659>\
**Category:** Kernel\
**Created:** [November 26, 2008, 3:35pm UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659 "2008-11-26T15:35:04Z")\
**Posts on this page:** 5\
**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:** [November 26, 2008, 3:35pm UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659/1 "2008-11-26T15:35:04Z")

</div>

**[mleonidos](https://sourceforge.net/u/mleonidos/)** wrote on [Wednesday, November 26, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/1c2697dc/#cb36):

HI,  
Would you help me with advice? I’m very new in ARM and FreeRTOS…

I need to port some C++ code to ARM with FreeRTOS.  
There is 2 ways: rewrite code using only C, or make some changes and try to use C++.

It would be very nice if someone tells me how to enable C++ support with Eclipse+arm-none-eabi-gcc compiler and FreeRTOS. When I try to enable it I get many error message… Would you give me some instructions and correct make\_file.

Or its better to rewrite all in C? =)

Thanks.

P.S. I found this [http://www.mediafire.com/?mmnth9cw99n](http://www.mediafire.com/?mmnth9cw99n). There is c++ example in it, but I can’t build it. Many errors ).

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 26, 2008, 3:39pm UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659/2 "2008-11-26T15:39:02Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Wednesday, November 26, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/1c2697dc/#cb36/245c):

Search this forum for C++. There are some posts with information on how to do this.

Basically, compiler the FreeRTOS code as C and your own code as C++ (the FreeRTOS headers are written for this), or remove the data hiding from the FreeRTOS code and compile it all as C++.

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [November 27, 2008, 4:13am UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659/3 "2008-11-27T04:13:49Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Thursday, November 27, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/1c2697dc/#cb36/ac43):

While I don’t use that exact combination, I do use FreeRTOS in a C++ project. The key is that the FreeRTOS files (which are of type .c) need to be compiled a “C” code, not C++ code. The compiler should have an option switch to make use the file extension to determine the compiling mode.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 27, 2008, 10:40am UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659/4 "2008-11-27T10:40:36Z")

</div>

**[mleonidos](https://sourceforge.net/u/mleonidos/)** wrote on [Thursday, November 27, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/1c2697dc/#cb36/2cea):

Thanks for your help.

I think I should go and learn about writing makefiles. =)  
If anybody have such makefile it would be nice to see it.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 27, 2008, 2:09pm UTC](https://forums.freertos.org/t/porting-some-c-code-to-freertos/659/5 "2008-11-27T14:09:06Z")

</div>

**[ravaz](https://sourceforge.net/u/ravaz/)** wrote on [Thursday, November 27, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/1c2697dc/#cb36/0b08):

Hi,

you can take a look on the following post, maybe it can help you:

[http://www.luminarymicro.com/component/option,com\_joomlaboard/Itemid,/func,view/catid,5/id,2306/](http://www.luminarymicro.com/component/option,com_joomlaboard/Itemid,/func,view/catid,5/id,2306/) #2306
