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

社会主义新天地 提交于 2019-12-10 11:24:29

问题


(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 ?


回答1:


The accepted answer doesn't seem to work for me, but this did:

cd /Library/Developer/CommandLineTools/Packages/
open .

and double clicking the pkg file.




回答2:


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



来源:https://stackoverflow.com/questions/52517784/codeblocks-c-compiling-with-macos-mojave-fatal-error-sys-cdefs-h-no-such

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!