【发布时间】:2020-11-27 18:34:38
【问题描述】:
我正在尝试使用 -fno-leading-underscore 选项编译我的 .cpp,但它会引发错误提示:
clang: error: unknown argument: '-fno-leading-underscore'
g++ -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -o kernel.o -c kernel.cpp
我该如何解决这个问题我是 Mac 新手,它曾经在 Linux Mint 上工作
【问题讨论】:
-
看来,clang 不支持这个选项
-
g++ --version是否说您正在使用 clang?或者您是否安装了 GCC 编译器(例如,brew install gcc)? -
我用 gcc 和 g++ 尝试了这个,结果是一样的。我不想删除 -fno-leading-underscore 的原因是应用程序包含各种文件,不仅是 c++,而且还有汇编程序,当我删除 -fno-leading-underscore 时,它需要更新这么多文件跨度>
-
我用 brew install gcc 安装了 GCC 编译器
-
@OmerOzhan 看看:gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/…。
Warning: the -fleading-underscore switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. **Not all targets provide complete support for this switch.**
标签: c++ macos terminal g++ clang++