Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12472 Discussions

Hello, I am using Quartus 18.1 release and I am trying to compile C++ code which requires libstdc++ std::to_string() and std::stoi() and a large number of other string related library function.

BAnde17
Beginner
1,147 Views

 Is there any way of enabling this portion of libstdc++ in nios2 toolchain.

 

I find a declaration of to_string() in  /cygdrive/c/intelFPGA/18.1/nios2eds/bin/gnu/nios2-elf/include/c++/5.3.0/bits/to_string.h but I can't seem to get the compiler to find this file if I explicitly add it to a small test case.

 

 I have tried setting -I<DirPAth> on the compile line as well without success.

I am new to the nios2-eds tool chain. Any pointers appreciated

Thanks

Bill

0 Kudos
3 Replies
GuaBin_N_Intel
Employee
315 Views
I don't see there is similar library name "to_string.h" in the installation path version 18.1 standard nor 18.0 standard "nios2eds/bin/gnu/nios2-elf/include/c++/5.3.0/bits". Is it a custom library?
BAnde17
Beginner
315 Views

​I installed Quartus Prime standard 18.1.0.625.   Looking back just now  I was confused about the file name I tried to include.   In the directory I mentioned there is a "basic_string.h" file which has an inline definition of the to_string ()  template functions variations I need.  The linker complains that to_string is not a member of std:: namespace.  If I drop the std:: This led me to believe that the header file is not being included  I am off working on something else right now so I don't have the example error handy. but this trivial test show the problem

 

 

#include <string>

using namespace std;

int main()

{

   string teststring("hey there");

   printf("srtring = %s \n", std::to_string(teststring);

   return 0;

}

~

 

$ nios2-elf-g++ -std=c++14 -c fo.cpp

fo.cpp: In function 'int main()':

fo.cpp:8:31: error: 'to_string' is not a member of 'std'

    printf("srtring = %s \n", std::to_string(teststring);

                              ^

Thanks for the response. Sorry I wasn't clearer.

Bill

 

 

BAnde17
Beginner
315 Views
Hello I am wondering if received my response to your posting. Do you know if the std::to_string function should be available in Nios2?? Thanks Bill Bill Anderson Contract Senior SW Engineer Waters Corporation (Cell) 508-843-7067 (office) 508-482-3399
Reply