Chapter 1:Getting Started
2011-11-01 21:54
330 查看
-->Editors
Emacs
-->Linux Programes
search path for file to execute
/bin:Binaries,progreams used in booting the system
/usr/bin:User binaries,standard programs available to users
/usr/local/bin:Local binaries,programs specific to an installation
":" separate entries in the path variable -->windows";"
"/" separate directory names in a filename -->windows"\"
-->Applications
/usr/bin
/usr/local/bin or /opt
-->Header Files
General Path /usr/include - /usr/include/sys - /usr/include/linux
X Window System /usr/include/X11
GNU C++ /usr/include/c++
$gcc -I/usr/openwin/include fred.c
$grep EXIT_ *.h
-->Library Files
Standard system libraries /lib and /usr.lib
.a for traditional,static lib
.so for shared lib
$gcc -o fred fred.c /usr/lib/libm.a
$gcc -o fred fred.c -lm
$gcc -o xllfred -L/usr/openwin/lib xllfred.c -lXll
-->Static Libraries
gcc:-sysroot=<目录> 将<目录>作为头文件和库文件的根目录
-B<目录> 将<目录>添加到编译器的搜索路径中
-V<版本> 为gcc制定目标机器
-v 显示编译器调用的程序
-S 编译到汇编语言,不进行汇编和链接
-c 编译、汇编到目标代码,不进行链接
-o<文件> 输出到
$gcc -c bill.c fred.c
$ls *.o
bill.o fred.o
$gcc -c main.c
$gcc -o main main.o bill.o fred.o
$./main
$ar crv libfoo.a bill.o fred.o
ar:-r 将文件插入备存文件中
c 建立备存文件
v 程序执行时显示详细的信息
V 显示版本信息
$ranlib libfoo.a/* It's not necessary for Linux,but harm-less*/
$gcc -o main main.o libfoo.a
$./main
$gcc -o main main.o -L. -lfoo
-->Shared Libraries
$ldd main
linux-gate.so.1=>(0xffffe000)
libc.so.6=>/lib/libc.so.6(0xb7db4000)
/lib/ld-linux.so.2(0xb7efc000)
-->Getting Help
$man gcc
$info gcc
Emacs
-->Linux Programes
search path for file to execute
/bin:Binaries,progreams used in booting the system
/usr/bin:User binaries,standard programs available to users
/usr/local/bin:Local binaries,programs specific to an installation
":" separate entries in the path variable -->windows";"
"/" separate directory names in a filename -->windows"\"
-->Applications
/usr/bin
/usr/local/bin or /opt
-->Header Files
General Path /usr/include - /usr/include/sys - /usr/include/linux
X Window System /usr/include/X11
GNU C++ /usr/include/c++
$gcc -I/usr/openwin/include fred.c
$grep EXIT_ *.h
-->Library Files
Standard system libraries /lib and /usr.lib
.a for traditional,static lib
.so for shared lib
$gcc -o fred fred.c /usr/lib/libm.a
$gcc -o fred fred.c -lm
$gcc -o xllfred -L/usr/openwin/lib xllfred.c -lXll
-->Static Libraries
gcc:-sysroot=<目录> 将<目录>作为头文件和库文件的根目录
-B<目录> 将<目录>添加到编译器的搜索路径中
-V<版本> 为gcc制定目标机器
-v 显示编译器调用的程序
-S 编译到汇编语言,不进行汇编和链接
-c 编译、汇编到目标代码,不进行链接
-o<文件> 输出到
$gcc -c bill.c fred.c
$ls *.o
bill.o fred.o
$gcc -c main.c
$gcc -o main main.o bill.o fred.o
$./main
$ar crv libfoo.a bill.o fred.o
ar:-r 将文件插入备存文件中
c 建立备存文件
v 程序执行时显示详细的信息
V 显示版本信息
$ranlib libfoo.a/* It's not necessary for Linux,but harm-less*/
$gcc -o main main.o libfoo.a
$./main
$gcc -o main main.o -L. -lfoo
-->Shared Libraries
$ldd main
linux-gate.so.1=>(0xffffe000)
libc.so.6=>/lib/libc.so.6(0xb7db4000)
/lib/ld-linux.so.2(0xb7efc000)
-->Getting Help
$man gcc
$info gcc
相关文章推荐
- 《C++ Primer》 Defined Terms Chapter 1. Getting Started
- 《C++ Primer 4th Edition》读书笔记 - Chapter1 Getting Started
- [译]Professional ASP.NET MVC3(03) - Chapter 1:Getting Started(下)
- Chapter 2 Getting Started
- Chapter 1. Getting started
- Chapter 2 Getting Started
- Beginning Linux Programming 4th Edition 学习笔记 - Chapter 1:Getting started
- Chapter 1. Getting Started(RETS helloworld)
- Introduction to Algorithm - Summary of Chapter 2(0) - Getting started
- [译]Professional ASP.NET MVC3(01)-Chapter 1:Getting Started(上)
- Chapter 1. Getting Started(1)
- !!!Chapter 1 Getting Started
- [译]Professional ASP.NET MVC3(02) - Chapter 1:Getting Started(中)
- Chapter2 Getting Started
- Chapter 0: Getting started
- MongoDB:The Definitive Guide CHAPTER 2 Getting Started
- Chapter 1. Getting Started
- 《C++ primer中文版》Chapter 1. Getting Started 第一章 快速入门
- C++ Primer 4th Notes - Chapter 1 Getting Started
- 读书笔记 - Beginning Linux Programming - Chapter 1 Getting Started