Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,034 Views

C++ 11

Hi, 

 

Has anybody used c++ 11 with Nios? By reading the release notes from quartus 13.1, it seems like gcc was upgraded to v4.7.3, which would include support for c++ 11. Now when I try to use some of the c++ 11 features (strongly typed enums, for example), I get this error 

 

 

# error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.  

 

Now if I add -std=c++11 to the build options the error remains. 

 

If I open a nios console and do 

 

gcc -v 

 

I get  

 

gcc version 4.5.3 (GCC) 

 

So, how do I switch to 4.7.3 or enable c++11 in 4.5.3?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
91 Views

Hi, 

 

we're currently going down the same road. By gcc - v you are refering to your host system. Instead you have to call: nios2-elf-gcc -v 

 

There you should get this: gcc version 4.7.3 (Altera 13.1 Build 162) 

 

Where currently also experimenting in exploring the c++ capabilities/support of the Nios. Yesterday we tried to use std::chrono but somehow it seems that the _GLIBCXX_USE_C99_STDINT_TR1 define is not set. 

Also we checked for the libstdc++.a and its contents and it seems like many of the constructs are not included. The problem might be that many C++11 constructs require a underlying OS - like std::thread for example. 

 

Sry for hijacking this thread, but I was about to open a thread on this issue myself. So here go some questions: 

 

Could somebody please give any indication on the include strucutre regarding the different directories (nios2-elf and H-i686-pc-linux-gnu)? 

How is the -std=c++11 flag set using the create-this_bsp/create-this-app script (at the moment we did this manually compiling the application)? 

Are there any experiences around regarding the limits of C++ and especially C++11 on the Nios? 

 

Thanks in advance! 

 

Regards!
Altera_Forum
Honored Contributor I
91 Views

Really no experiences on C++ around?!? I'd be already helpfull to know how to properly approach a C++ software project - even neglecting the C++11 standard? Which adjustments to make in the create_this_bsp and create_this_app scripts etc? 

 

As I couldn't find any documentation on that either, I might have to contact Altera directly...
Reply