Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开发环境与平台选择章节关于g++编译命令的说明存在问题 #38

Open
Moyv-Wang opened this issue Sep 5, 2024 · 1 comment

Comments

@Moyv-Wang
Copy link

我查看了已经关闭的Issue似乎没有人提出这一点

g++ -c main.cpp -o main

这样就可以得到可执行文件 main 了。

-c参数让编译器只进行编译操作,输出的结果不是可执行文件。事实上如果不通过-o参数指定生成文件的文件名,将会得到一个.o文件。
这是个很小的错误,但是对于我这样入门时即被误导使用VS2019等IDE的开发者来说,发现命令行返回“无法执行二进制文件:可执行文件格式错误”让我十分不解🥲

@archibate
Copy link
Contributor

对不起!不应该有-c的,那会生成.o文件,已修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants