0

I've spent several hours attempting to find out as to why I cannot compile my application that uses spdlog due to several errors related to cmath having no member in its global namespace:

In file included from lib/spdlog/include/spdlog/fmt/bundled/format.h:38:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:327:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:328:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;

I had initially made the assumption that this was due to Premake not finding the MacOS SDK given that the path to the sysroot was not previously declared in my script. I made sure to add it to my link options before retrying:

    linkoptions
    {
        "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
    }

However, this issue still persists and I've failed to find any other issues online related to this problem both on the official wikis of premake and spdlog. Any help would be very much appreciated.

Lux
  • 1
  • Read the documentation of your C++ compiler, perhaps [GCC](http://gcc.gnu.org/) or [Clang](http://clang.llvm.org/). Read also the documentation of [make](https://www.gnu.org/software/make/manual/html_node/index.html). Read of course more about [premake](https://github.com/premake/premake-core/wiki) and consider using other [build automation](https://en.wikipedia.org/wiki/Build_automation) tools. Of course read more about [C++ programming language](https://en.cppreference.com/w/cpp) – Basile Starynkevitch May 12 '20 at 01:13

2 Answers2

1

Make sure you have downloaded the latest 'Command Line Tools for Xcode 11.4.1' package and run this from a terminal (command line):

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_11.4.1.pkg

Can't compile C program on a Mac after upgrade to Mojave

273K
  • 29,503
  • 10
  • 41
  • 64
  • That package doesn't appear to be available on 10.15.4 Catalina. Apple having seemingly made this more of a headache than it needs to be. – Lux May 12 '20 at 03:07
  • What package of the newest is available? – 273K May 12 '20 at 03:51
  • The newest is 11.5 Beta. However, I've tried using both Xcode and Command Lines Tools but to no avail. Based on what I'd read, it appears the headers are no longer available at ```/usr/include``` and instead are within the SDK though even if my ```-isysroot``` points to correct SDK, the headers are still not found. I appreciate your help greatly but I think I might just install a Linux Distro on my MBP as there is too many issues I'm facing trying to develop on macOS. Prior the 10.15 this wasn't an issue. – Lux May 12 '20 at 17:56
-1

sudo vim /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath

search <math.h>

change #include <math.h> to #include "math.h"

save and exit

try again to compile