linux - don't understand the difference between "gcc -c file.c" and "gcc -o file.c" command
问题描述
Command :
`gcc -c -Wall hello.c`
Here is the error : while calling ./hello.o
bash: ./hello.o: cannot execute binary file: Exec format error
need help please ..
解决方案
.o 是目标文件,而不是可执行文件。这是一个中间步骤。-c 选项只是说要迈出这一步。您仍然必须将该目标文件链接到可执行文件中。
推荐阅读
- ios - iOS:如何通过推送通知显示警报并无休止地播放声音
- c# - Rider ASP 项目无法启动,但它在 Visual Studio 中工作
- java - Gradle 找不到 com.google.protobuf
- android - 无法生成 R.string.page_title、R.string.page_title、R.layout.main 等
- neo4j - 在 neo4j 中获取关注者的帖子以及自己的帖子
- c# - 如何从同一个 .NET 应用程序中提供静态内容和动态内容?
- mysql - 在 Netbeans 中创建自动生成的 ID 时,值始终设置为 0 而不是 1
- javascript - 对我来说,出乎意料的是,从机器人框架中的 javascript 返回值。为什么?
- python - ANTLR4 + Python - 如何从侦听器访问片段令牌(子令牌)?
- laravel - 多对多关系 - 它不显示元素