我的CPP之路

路漫漫其修远兮
随笔 - 42, 文章 - 0, 评论 - 16, 引用 - 0
数据加载中……

gcc中的option使用笔记

记录下使用gcc新学的选项,-c,-Wall,-Werror,-O,-Idir,-llibrary,-pthread。目前,无法理解didier老师的Makefile中的-lpthread,-D_UNIX和-lm选项。主要还是要查阅gcc的官方manual,分为编译选项和link选项等。。。比如4.4.5的使用手册:
http://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/index.html#toc_Option-Index

       file.cc
       file.cp
       file.cxx
       file.cpp
       file.CPP
       file.c++
       file.C
           C++ source code which must be preprocessed.  Note that in .cxx, the last two letters must both be literally x.  Likewise, .C
           refers to a literal capital C.

       -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.

           By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.

           Unrecognized input files, not requiring compilation or assembly, are ignored.

       -Wall
           This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or
           modify to prevent the warning), even in conjunction with macros.

       -O
       -O1 Optimize.  Optimizing compilation takes somewhat more time, and a lot more memory for a large function.

           With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great
           deal of compilation time.

-Idir
    Add the directory dir to the head of the list of directories to be searched for header files.

-llibrary
-l library
    Search the library named library when linking.
-pthread
    Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker.
-pthread
    Add support for multithreading using the POSIX threads library.
-D name
    Predefine name as a macro, with definition 1.
-Werror=
    Make the specified warning into an error.


posted on 2010-12-24 11:32 yanvenhom 阅读(489) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理