如何使用 GNU 工具链学习 C 编程?

发布于 2024-09-30 09:06:31 字数 460 浏览 2 评论 0原文

我是编程新手,对 Linux 更陌生。有人告诉我,Linux 是学习编程的最佳操作系统,因为它可以让程序员与机器架构紧密交互。我听说过很多关于 GNU 工具链的信息,它提供了 Linux 上最好的编程环境,所以我决定不使用 IDE,并投入尽可能多的时间来以正确的方式学习东西。

我刚刚安装完 Ubuntu 10.10。我安装了 Vim 并开始学习将它用于我的文本编辑器。我还能够验证 GCC 和 GDB 是否存在于我的系统上。 我正在从书中学习 C 编程 - 计算机科学:使用 C 的结构化编程方法。虽然它解释了如何使用编辑器、编译器、链接器和运行器来开发和运行程序,但它没有解释如何设置和使用它们。所以我的问题是,一旦我在文本编辑器中编写了源代码,如何调用 GNU 工具链来编译和运行我的程序。

I am new to programming, and even newer to Linux. I was told that Linux is the best OS to learning to program as it lets a programmer interface closely with the machine architecture. I heard a lot about the GNU tool-chain and that it provides the best programming environment on Linux so I decided I won't use an IDE and put in as much time is needed to learn things the right way.

I have just finished installing Ubuntu 10.10. I installed Vim and started learning to use it for my text-editor. Also I have been able to verify that GCC and GDB are present on my system.
I am learning to program in C from the book - Computer Science: A Structured Programming Approach using C. Though it explains how editor, compiler, linker and runner are used to develop and run programs, it doesn't explain how to set them up and use them. So my question is, once I have the source-code written in my text-editor, how do I invoke the GNU tool-chain to compile and run my program.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北笙凉宸 2024-10-07 09:06:31

使用某个名称保存它,例如 filename.c,然后调用 gcc 并调用二进制文件(默认情况下名为 a.out)

gcc filename.c
./a.out

save it with some name, e.g. filename.c and then call gcc and invoke the binary (named a.out by default)

gcc filename.c
./a.out
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文