GCC编译器优化,不能与x86_64体系结构的主要可执行文件'_'链接 [英] GCC Compiler Optimizations, can't link with a main executable file '_' for architecture x86_64

查看:885
本文介绍了GCC编译器优化,不能与x86_64体系结构的主要可执行文件'_'链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

* Antonio10ms $ gcc pi.c -o1 pi

ld:无法与架构x86_64的主要可执行文件'pi'链接

clang:错误:linker命令失败,退出代码1(使用-v查看调用)



我需要帮助以进行优化my .cpp

解决方案

我认为你在输出/目标参数中混淆了优化参数。 b

我想你想要什么是

  gcc pi.c -o1 -o pi 



其中
-o1表示优化级别1

-o pi表示输出到名为pi的可执行文件


*Antonio10ms$ gcc pi.c -o1 pi
ld: can't link with a main executable file 'pi' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I need help please to make an optimization to my .cpp

解决方案

I think you are confusing the optimization argument with the output/target argument.

I think what you want is

gcc pi.c -o1 -o pi

where "-o1" means "optimization level 1" and "-o pi" means "output to an executable named pi"

这篇关于GCC编译器优化,不能与x86_64体系结构的主要可执行文件'_'链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆