Search code examples
c++compilationcodeblocksmath.hmacos-mojave

Code::Blocks C++ compiling with MacOS Mojave : fatal error: sys/cdefs.h: No such file or directory


(This is my first question ever on StackOverflow)

I have to use a Mac at work, and I'm coding in C++ with Code::Blocks (because I am used to this IDE). 2 days ago I upgraded from MacOS High Sierra to MacOS Mojave and I can fairly say that... it was a bad decision.

Now, when trying to #include <math.h> I get this error : fatal error: sys/cdefs.h: No such file or directory. I have tried to reinstall the xcode line command tools with xcode-select --install, but it still doesn't work.

Does anybody have a clue of what is going on, and how I could solve this issue ?


Solution

  • Problem solved by reinstalling gcc. Location of headers has probably changed between High Sierra and Mojave.

    I suggest to anyone encountering the same problem to do the same and also to (re)install the xcode line command tools with xcode-select --install