cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
6,952 Views
Registered: ‎05-21-2015

Micro Blaze C++/C mixed

Hi!

 

I'm new to microblaze, so I hope you can help me.

Currently I use

Xilinx SDK: Release 14.7 Build SDK_P.20131013

 

There is already an existing project written in C, which I have to extend. I want to program the new parts in C++ but it does not work until now.

1.) I tried to simply add a *.cpp file to my project which was not compiled because no toolchain was selected. It was only possible to select the g++ compiler (an error occured on clicking "Apply" but the compiler was selected correct on clicking OK)

2.) g++ complied with a fatal error about the -c option which was set to be given to gcc.

3.) when I removed the -c option the rest of the code written in C did not compile correctly anymore. (I saw mainly that the compiler complied then about lines which declared an extern variable.

 

so please can you help me how I can use C++ in my project?

 

Thx

Andreas

Selecting g++ for a CPP file and click apply results in error.jpg
g++ error because of -c option applied to gcc .jpg
applied -c option which generates a problem for g++.jpg
0 Kudos
2 Replies
Highlighted
Anonymous
Not applicable
6,929 Views

No, you will need to use the C++ compiler and wrap your  existing C code in an exter. For example:

extern "language_name" { declaration ; declaration ; ... }

0 Kudos
Highlighted
6,837 Views
Registered: ‎05-21-2015

hey thanks for your help, unfortunately I can't change all the files from c to cpp as there are other people also working on the project.

 

normally it should go well if I only use the c++ compiler for the .cpp files, isn't it?

files needed to link against the c files get an extern"C" declaration in front.

 

Is there another way possible to use cpp sources in that constellation?

0 Kudos