简体   繁体   English

c++:错误:无法识别的命令行选项“-target”

[英]c++: error: unrecognized command-line option ‘-target’

Im compiling a program I made using make and I get this error我正在编译我使用make的程序,但出现此错误

c++: error: unrecognized command-line option ‘-target’
make[3]: *** [libs/system/CMakeFiles/system.dir/build.make:76: libs/system/CMakeFiles/system.dir/src/system/syscalls.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:504: libs/system/CMakeFiles/system.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:243: CMakeFiles/image-uefi.dir/rule] Error 2
make: *** [Makefile:137: image-uefi] Error 2

Im running Arch Linux with Clang-13, CMake and all of base-devel installed.我正在运行带有 Clang-13、CMake 和所有基础开发的 Arch Linux。

Any help would be appreciated, please dont be condescending I just installed Arch Linux and am getting this error, in Fedora compiling the exact same app provides no error.任何帮助将不胜感激,请不要居高临下,我刚刚安装了 Arch Linux 并收到此错误,在 Fedora 中编译完全相同的应用程序没有错误。

The line which created the error is this, it should be the offending linux since the error in question(the top line) complains about -target being unrecognized.创建错误的行是这样的,它应该是有问题的 linux 因为有问题的错误(顶行)抱怨 -target 无法识别。

cd /home/user/toy-kernel/build/libs/system && /usr/bin/c++ -I/home/user/toy-kernel/libs/system/src -target x86_64-none-elf -mcmodel=kernel -fno-exceptions -fno-use-cxa-atexit -fno-rtti -nostdlib -ffreestanding -fno-threadsafe-statics -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-3dnow -mno-3dnowa -std=gnu++20 -MD -MT libs/system/CMakeFiles/system.dir/src/system/syscalls.cpp.o -MF CMakeFiles/system.dir/src/system/syscalls.cpp.o.d -o CMakeFiles/system.dir/src/system/syscalls.cpp.o -c /home/user/toy-kernel/libs/system/src/system/syscalls.cpp

In my case, c++ was the g++ compiler instead of the clang compiler, if you are having a similar issue try updating g++ or clang++(on older macs you may need to have to use brew to install those) or going in your /usr/bin directory(for mac and linux, I never used windows cant help you) and replacing the files(though only do that if you absolutely know what your doing.). In my case, c++ was the g++ compiler instead of the clang compiler, if you are having a similar issue try updating g++ or clang++(on older macs you may need to have to use brew to install those) or going in your /usr/ bin 目录(对于 mac 和 linux,我从未使用过 windows 无法帮助您)并替换文件(尽管只有在您绝对知道自己在做什么时才这样做。)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 g++:错误:无法识别的命令行选项“--cflags” g++:错误:无法识别的命令行选项“--libs” - g++: error: unrecognized command-line option '--cflags' g++: error: unrecognized command-line option '--libs`' C ++错误:无法识别的命令行选项“ -msse3” - c++ error:unrecognized command line option '-msse3' c++:错误:无法识别的命令行选项“-std=c++17” - c++: error: unrecognized command line option ‘-std=c++17’ g++:错误无法识别的命令行选项 -municode 使用 Cygwin - g++: error unrecognized command-line option -municode using Cygwin C++:错误:无法识别的命令行选项“-std=gnu++14” - c++: error: unrecognized command line option ‘-std=gnu++14’ 构建C ++库时出现mno-cygwin无法识别的命令行选项错误 - mno-cygwin unrecognized command line option error when building c++ library 如何在c / c ++的命令行程序中创建--help选项? - How do I create a --help option in a command-line program in c/c++? C ++中的命令行参数 - Command-line arguments in C++ 为arm交叉编译opencv:C++:错误:无法识别的命令行选项'-mthumb'; 你的意思是“-mtbm”? - cross-compile opencv for arm : c++: error: unrecognized command line option ‘-mthumb’; did you mean ‘-mtbm’? C ++删除命令行 - C++ Removing the command-line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM