Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug report - std::sto* in g++ #377

Closed
jaiselrahman opened this issue Jul 30, 2016 · 5 comments
Closed

bug report - std::sto* in g++ #377

jaiselrahman opened this issue Jul 30, 2016 · 5 comments
Assignees
Labels
bug report Something is not working properly

Comments

@jaiselrahman
Copy link

jaiselrahman commented Jul 30, 2016

First of all, Thank you for this great app
It is helps me greatly for learning programmings

I found that when compiling this c++ code using g++

    #include<iostream>
    #include<string>
    using namespace std;
    int main()                                     
    {                    
        string s="566";                       
        int i;
        i=stol(s); 
        cout<<i;                             
        cout<<'\n'<<stod("937");
        cout<<'\n'<<to_string(239.399);
        return 0;
  } 

the compiler throws error

stoi.cpp: In function 'int main()':
stoi.cpp:10:11: error: 'stol' was not declared in this scope
i=stol(s);
^
stoi.cpp:12:25: error: 'stod' was not declared in this scope
cout<<'\n'<<stod("937");
^
stoi.cpp:13:32: error: 'to_string' was not declared in this scope
cout<<'\n'<<to_string(239.399);
^

my compiler version is 6.1.0

@jaiselrahman jaiselrahman changed the title bug report bug report - std::sto* in g++ Jul 30, 2016
@fornwall fornwall self-assigned this Jul 30, 2016
@fornwall
Copy link
Member

This is a bug in the Android NDK (which Termux is based on): android/ndk#82

It is scheduled to be resolved in the next release (r13) of the NDK, at which time the fix will propagate to Termux as a package update!

@jaiselrahman
Copy link
Author

thanks

i found that adding these to above headers fixes the problem (temporarily)

    #define _GLIBCXX_HAVE_WCSTOF 1
    #define _GLIBCXX_USE_C99 1

Again thanks for this awesome app

@fornwall
Copy link
Member

fornwall commented Apr 2, 2017

Unfortunately the progress on the NDK side has been slower than expected. However, according to the NDK roadmap, the next release (r15) states:

With this project finished, libc++ will be safe to use

If it works ok, the plan is to switch to libc++ in Termux when r15 of the NDK is available. This will bring us a modern C++ library fixing these and other issues.

The NDK release schedule currently has r15 marked for release during Late May/Early June 2017.

@Exaeta
Copy link

Exaeta commented May 31, 2017

@fornwall Can we get the beta version? This is stopping me from compiling software I want to try to use on android...

@fornwall
Copy link
Member

Termux has just switched to libc++, so after updating packages things such as std::to_string, std::stod and friends should start working!

Note that C++ programs and libraries should be rebuilt completely, as Termux now links against libc++ by default, and you don't want to mix STL implementations in the same program.

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly
Projects
None yet
Development

No branches or pull requests

4 participants