# Compiling C++ Files in Freedom SDK Problem

**URL:** <https://forums.sifive.com/t/compiling-c-files-in-freedom-sdk-problem/3251>\
**Category:** SiFive RISC-V Core IP Evaluation\
**Created:** [January 19, 2020, 10:23am UTC](https://forums.sifive.com/t/compiling-c-files-in-freedom-sdk-problem/3251 "2020-01-19T10:23:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kareem.abdelmoniem](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@kareem.abdelmoniem](https://forums.sifive.com/u/kareem.abdelmoniem)\
**Post date:** [January 19, 2020, 10:23am UTC](https://forums.sifive.com/t/compiling-c-files-in-freedom-sdk-problem/3251/1 "2020-01-19T10:23:00Z")

</div>

Hello there, I’m trying to compile some C++ files to run on SiFive targets but it always fails, I think it’s a linker script problem so is there any tutorial or guidelines to how to add C++ files to my Freedom SDK project or it’s not supported at all? Thanks.

---

<div class="post-metadata">

**Author:** ![Jim](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jim/32/632_2.png) [@Jim](https://forums.sifive.com/u/Jim)\
**Post date:** [January 23, 2020, 5:19pm UTC](https://forums.sifive.com/t/compiling-c-files-in-freedom-sdk-problem/3251/2 "2020-01-23T17:19:20Z")

</div>

Hi Kareem,

C++ is not a supported feature of the freedom-e-sdk at this time but some users have been able to make adjustments for specific cases. Below are some notes on what might be required.

makefile in the src directory needs to be modified to pick up .cpp files.

_#include “cpu.h”_ may have to be changed to _extern “C” { #include \<metal/cpu.h\> }_

freedom-e-sdk specs files add -nostartfiles and then add in a custom crt0.o, but crti.o, crtbegin.o, crtend.o, and crtn.o are missing. This can cause link errors for missing symbols if you link with libstdc+. It may break some C++ features like static constructors and destructors, frame unwinding for exceptions, etc.
