Skip to content

Missed <cmath> multiple building errors #143

@akontsevich

Description

@akontsevich

Have following errors building the library:

.../tinygps/TinyGPS++.cpp:331: error: ‘cos’ was not declared in this scope
.../tinygps/TinyGPS++.cpp:331:19: error: ‘cos’ was not declared in this scope
  331 |   double cdlong = cos(delta);
      |                   ^~~
.../tinygps/TinyGPS++.cpp:341: error: ‘sqrt’ was not declared in this scope; did you mean ‘sq’?
.../tinygps/TinyGPS++.cpp:341:11: error: ‘sqrt’ was not declared in this scope; did you mean ‘sq’?
  341 |   delta = sqrt(delta);
      |           ^~~~
      |           sq
.../tinygps/TinyGPS++.cpp:359: error: ‘atan2’ was not declared in this scope
.../tinygps/TinyGPS++.cpp:359:8: error: ‘atan2’ was not declared in this scope
  359 |   a2 = atan2(a1, a2);
      |        ^~~~~
.../tinygps/TinyGPS++.cpp:343: error: ‘atan2’ was not declared in this scope
.../tinygps/TinyGPS++.cpp:343:11: error: ‘atan2’ was not declared in this scope
  343 |   delta = atan2(delta, denom);
      |           ^~~~~
.../tinygps/TinyGPS++.cpp:356: error: ‘sin’ was not declared in this scope
.../tinygps/TinyGPS++.cpp: In static member function ‘static double TinyGPSPlus::courseTo(double, double, double, double)’:
.../tinygps/TinyGPS++.cpp:356:15: error: ‘sin’ was not declared in this scope
  356 |   double a1 = sin(dlon) * cos(lat2);
      |               ^~~
.../tinygps/TinyGPS++.cpp:356: error: ‘cos’ was not declared in this scope
.../tinygps/TinyGPS++.cpp:356:27: error: ‘cos’ was not declared in this scope
  356 |   double a1 = sin(dlon) * cos(lat2);
      |                           ^~~

Fixed by adding

#include <cmath>

to src/TinyGPS++.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions