macos 无法在 OS/X 中找到 C++ 标准库的位置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/995902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:13:18  来源:igfitidea点击:

Unable to find the location of C++'s standard libraries in OS/X?

c++macos

提问by Léo Léopold Hertz ??

I have looked at /System/Library, but I have not found the iostream library/module by

我查看了 /System/Library,但我没有找到 iostream 库/模块

ack iostream

Where are the standard libraries in OS/X?

OS/X 中的标准库在哪里?

回答by Ryan Tuck

On OS X 10.10 Yosemite, they're located here:

在 OS X 10.10 Yosemite 上,它们位于:

/usr/include/c++

/usr/include/c++

回答by Eugene Bujak

Please make sure you have XCodeinstalled first.

请确保您先安装了XCode

Without xcode you won't be able to develop C/C++ applications since xcode includes all linkable standard libraries and headers.

没有 xcode,您将无法开发 C/C++ 应用程序,因为 xcode 包含所有可链接的标准库和头文件。

回答by jmtd

iostream is a C++ thing, not C. You might get more help if you re-tag your question appropriately.

iostream 是 C++ 的东西,而不是 C。如果您适当地重新标记您的问题,您可能会获得更多帮助。

回答by Aiden Bell

IIRC, /usr/local/lib ... Try adding -L/usr/local/lib to your GCC build options. Although the stdc++ libraries shouldbe in your linker path already. Compiler errors usually indicate missing headers / syntax error while linker errors indicate missing binary blobbage.

IIRC, /usr/local/lib ... 尝试将 -L/usr/local/lib 添加到您的 GCC 构建选项中。尽管 stdc++ 库应该已经在您的链接器路径中。编译器错误通常表示缺少头文件/语法错误,而链接器错误表示缺少二进制 blobbage。

回答by Zifeng Zhang

for me it is under the Xcode library directory: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/.

对我来说,它在 Xcode 库目录下:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/。

My OS is Catalina.

我的操作系统是 Catalina。

回答by Ishan Patel

On macOS MOJAVE 10.14, it's located at:

在 macOS MOJAVE 10.14 上,它位于:

usr/local/include/c++/

回答by Kieveli

Try /usr/lib/ or /usr/local/lib/

试试 /usr/lib/ 或 /usr/local/lib/