记录gcc和make的一些东西
2012-06-13 14:37
232 查看
-llibrary
-l library
Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)
第二种不推荐
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but
before bar.o. If bar.o refers to functions in z, those functions may not be loaded.
因此,foo.o -lz bar.o在foo.o后bar.o前搜索z库,如果bar.o调用了z路里的函数,则该函数不能被加载
The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
The directories searched include several standard system directories plus any that you specify with -L.
库目录加-L
Normally the files found this way are library files---archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced
but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l surrounds library with lib and .a and searches several directories.
唯一不同, -l在库前后夹lib和.a,在多个目录中寻找
-lobjc
You need this special case of the -l option in order to link an Objective-C or Objective-C++ program.
也可以连接目标文件
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code
for AMD's x86-64architecture. For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options.
控制生成32位或64位的代码。32位的环境设置int, long, 指针为32位在任何i386的机器上;64位环境设置int为32位,long和指针为64位在AMD's x86-64architecture结构上
-c
Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
只编译,不连接(也就是说没有设置-c标志 就自动编译并连接),输出目标文件
By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.
用.o后缀替换.c .i .s 后缀
Unrecognized input files, not requiring compilation or assembly, are ignored.
-o file
Place output in file file. This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code.
输内容放到file中,不管他是可执行的或目标文件等等
If -o is not specified, the default is to put an executable file in a.out, the object file for source.suffix in source.o, its assembler file in source.s, a precompiled header file in
source.suffix.gch, and all preprocessed C source on standard output.
未说明,则可执行输出为a.out, 目标文件为source.o, source为源文件名
-Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes
-Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Map=output.map.
将逗号后的"option"作为选项传递给链接器。如果"option"有逗号,会被分割成多个选项。
如-Wl,-rpath,. 指定了在当前目录搜索动态库
-Wl,-soname,libto.so.1指定用那个版本库
%zu
size_t、ssize_t。这两个类型到处都在用。printf() 为此专门定义了 "z" 前缀来支持这两个类型(即使用 "%zu" 或 "%zd" 来打印)。z只linux支持,windows下不支持,是gcc的扩展
-l library
Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)
第二种不推荐
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but
before bar.o. If bar.o refers to functions in z, those functions may not be loaded.
因此,foo.o -lz bar.o在foo.o后bar.o前搜索z库,如果bar.o调用了z路里的函数,则该函数不能被加载
The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
The directories searched include several standard system directories plus any that you specify with -L.
库目录加-L
Normally the files found this way are library files---archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced
but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l surrounds library with lib and .a and searches several directories.
唯一不同, -l在库前后夹lib和.a,在多个目录中寻找
-lobjc
You need this special case of the -l option in order to link an Objective-C or Objective-C++ program.
也可以连接目标文件
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code
for AMD's x86-64architecture. For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options.
控制生成32位或64位的代码。32位的环境设置int, long, 指针为32位在任何i386的机器上;64位环境设置int为32位,long和指针为64位在AMD's x86-64architecture结构上
-c
Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
只编译,不连接(也就是说没有设置-c标志 就自动编译并连接),输出目标文件
By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.
用.o后缀替换.c .i .s 后缀
Unrecognized input files, not requiring compilation or assembly, are ignored.
-o file
Place output in file file. This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code.
输内容放到file中,不管他是可执行的或目标文件等等
If -o is not specified, the default is to put an executable file in a.out, the object file for source.suffix in source.o, its assembler file in source.s, a precompiled header file in
source.suffix.gch, and all preprocessed C source on standard output.
未说明,则可执行输出为a.out, 目标文件为source.o, source为源文件名
-Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes
-Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Map=output.map.
将逗号后的"option"作为选项传递给链接器。如果"option"有逗号,会被分割成多个选项。
如-Wl,-rpath,. 指定了在当前目录搜索动态库
-Wl,-soname,libto.so.1指定用那个版本库
%zu
size_t、ssize_t。这两个类型到处都在用。printf() 为此专门定义了 "z" 前缀来支持这两个类型(即使用 "%zu" 或 "%zd" 来打印)。z只linux支持,windows下不支持,是gcc的扩展
相关文章推荐
- 整理一下之前工作中记录过的一些东西——informix
- [杂谈]开个Blog记录一些开发相关的东西
- 整理一下之前工作中记录过的一些东西——sequence:在这里可以解释为"序列"
- 记录一些hash的东西
- 记录一些东西
- 有关GCC的一些记录笔记
- 一些非常非常基本的东西的记录
- 随手记录一些学到得东西
- 『C#基础』一些零碎东西的记录(持续更新)
- 记录一些东西
- 开始记录一些东西吧
- fiddler 记录一些以前不熟悉的东西
- 记录一些在VPS上折腾的东西
- 记录一些我开发经常用的东西
- 记录一些东西
- 阅读rocketmq的consumer源码的随笔记录的一些东西
- 记录一些关于android,cocos2d-x,objective-c,mfc,directX,c++,数学的东西
- 好久没有在这个地方记录一点自己的东西了,借此记载一些S3C6410的开发点滴
- 续写Android布局中一些琐碎的东西整理记录
- 记录:gcc的一些宏