Forum Discussion

corestar's avatar
corestar
Icon for Contributor rankContributor
5 years ago

How to use C++ with NIOS tools?

I'm using Quartus 18.0 Std with the NIOS tools. I'm having a terrible time getting C++ to work in any sensible fashion. There appear to be all sorts of "quirks". Do you have to set some special setting to use C++?

One example, I have a function declared in a header as:

extern int ultoa(uint value, char *buffer, uint base = 10, bool sign = false);

If I attempt to use the function in a cpp file, it gives the error shown in the argument_error.jpg.

If comment out declaration of ultoa in the .h file and move it to the .cpp file, the error disappears. The code works correctly in both cases. I tried changing the .h file to .hpp to no avail.

Another quirk is if I use a .hpp extension for headers, it cannot find headers located in the BSP. But if I leave it as .h, it finds them fine. I prefer .h, but it does not seem to recognize C++ code.

1 Reply