Opened 6 years ago
Closed 5 years ago
#875 closed defect (fixed)
atof undefined reference compiling with android NDK
Reported by: | Alberto Bignotti | Owned by: | strk |
---|---|---|---|
Priority: | trivial | Milestone: | 3.6.4 |
Component: | Core | Version: | main |
Severity: | Critical | Keywords: | NDK atof |
Cc: |
Description
I use Geos (latest 31 May 2018) for android development using NDK Version 16.1
I occurrend in this issue: https://stackoverflow.com/questions/14571399/android-ndk-cant-find-atof-function
In my project I link statically libgeos.a and get "error: undefined reference to 'atof'" during compilation.
In order to make geos static lib work on my app, I need to modify "src/geom/Envelope.cpp" removing references to atof. After this update everything works fine.
https://git.osgeo.org/gitea/geos/geos/src/branch/master/src/geom/Envelope.cpp
From:
/*public*/ Envelope::Envelope(const string &str) { // The string should be in the format: // Env[7.2:2.3,7.1:8.2] // extract out the values between the [ and ] characters string::size_type index = str.find("["); string coordString = str.substr(index + 1, str.size() - 1 - 1); // now split apart the string on : and , characters vector<string> values = split(coordString, ":,"); // create a new envelopet init(::atof(values[0].c_str()), ::atof(values[1].c_str()), ::atof(values[2].c_str()), ::atof(values[3].c_str())); }
To:
/*public*/ Envelope::Envelope(const string &str) { // The string should be in the format: // Env[7.2:2.3,7.1:8.2] // extract out the values between the [ and ] characters string::size_type index = str.find("["); string coordString = str.substr(index + 1, str.size() - 1 - 1); // now split apart the string on : and , characters vector<string> values = split(coordString, ":,"); // create a new envelopet init(strtod(values[0].c_str(), NULL), strtod(values[1].c_str(), NULL), strtod(values[2].c_str(), NULL), strtod(values[3].c_str(), NULL)); }
Note:
See TracTickets
for help on using tickets.
In 56fc416/git: