本文介绍了升级到Catalina 10.15后,无法在Mac上编译C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

有一个先前的问题不能升级到Mojave后,在Mac上编译C程序,其答案涵盖了出现问题的大多数变体.

There's a previous question Can't compile C program on a Mac after upgrade to Mojave, and the answers to that have covered most of the variations on what goes wrong.

现在-从2019年10月7日开始-您可以升级到macOS Catalina 10.15.同样,即使在升级(从Mojave 10.14.6)升级到Catalina之前安装了XCode 11.0,升级过程中/usr/include目录也被删除了.因此,编译器期望存在/usr/include目录,因此不再起作用.

Now — as of Monday 2019-10-07 — you can upgrade to macOS Catalina 10.15. Once again, during the upgrade, the /usr/include directory has been blown away by the update, even though XCode 11.0 was installed before upgrading (from Mojave 10.14.6) to Catalina. Consequently, compilers built to expect that there is a /usr/include directory do not work any longer.

针对Mojave问题的主要推荐步骤-使用命令:

The main recommended step for the Mojave issues — using the command:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

不能正常工作,因为目录/Library/Developer/CommandLineTools/Packages/不存在(因此还没有要打开的.pkg文件).

does not work out of the gate because the directory /Library/Developer/CommandLineTools/Packages/ does not exist (so there's not yet a .pkg file to open).

是否有一种很好的(官方)方式来创建和填充目录/usr/include?

Is there a good (official) way to create and populate the directory /usr/include?

推荐答案

对我来说,向CPATH添加以下路径可以解决此问题:

For me adding the following path to CPATH solved the issue:

export CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

这篇关于升级到Catalina 10.15后,无法在Mac上编译C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 09:28