据linux c一站式编程讲,linux下c语言开发需要如下工具:
- gcc: The GNU C compiler
- libc6-dev: GNU C Library: Development Libraries and Header Files
- manpages-dev: Manual pages about using GNU/Linux for development
- manpages-posix-dev: Manual pages about using a POSIX system for development
- binutils: The GNU assembler, linker and binary utilities
- gdb: The GNU Debugger
- make: The GNU version of the “make” utility
一.安装gcc编译器(ubuntu自带gcc)
sudo apt-get install build-essential
使用gcc --version查看版本
二.hello wrold
#include <stdio.h> int main(void) { printf("hello world/n"); return 0; }
打开shell,执行
gcc hello.c -o hello
如果不加-o选项,默认输出a.out
然后运行使用./hello或者./a.out