Linux Programming Tools Series 1 -- Compiler/Make Robert Yu May 25, 2011 How to Get Help in Linux ? man(1) – show online manual page. – usage: ? man keyword ? man section-no keyword ? man – a keyword ? info(1) – More detailed manual for mands. piler for C/C++ ? dump macro definition in preprocessing – g++ -E – dD – o ? dump include file hierarchy – G++ -H – o test ? dump file dependencies g++/gcc/ld ? Basic usage – gcc – o test – g++ -o test ? Common options –-I extra-include-path // add search paths for include files (order) –-L extra-lib-path // add dir to the list of directories for libs –-l xxx // to link extra –-Dmacro[=defn] // define extra macro –-g // add debug information –-pg // add extra code for gprof –-Olevel // -O3 maximum optimize ? Typical usage – g++ -O3 – g – DDEBUG -o test – I ../common/include – L ../common/lib – lcommon – lpthread gcc/g++ special usage (1) ?$ g++ -o test -### – Using built-in specs. – Target: x86_64-redhat-linux – Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info -- enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib -- enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable- languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable- plugin --with-java-home=/usr/lib/jvm/java--gcj- --with-cpu=generic -- host=x86_64-redhat-linux – Thread model: posix – gcc version 20071124 (Red Hat -42) – "/usr/libexec/gcc/x86_64-redhat-linux// cc1plus " "-quiet" "-D_GNU_SOURCE" "" "- quiet" "-dumpbase" "" "-mtune=generic" "-auxbase" "test" "-o" "/" – " as " "-Qy" "-o" "/" "/" – "/usr/libexec/gcc/x86_64-redhat-linux// collect2 " "--eh-frame-hdr" "-m" "elf_x86_64" "-- hash-style=gnu" "-dynamic-linker" "/lib64/ld-linux-x86-"
piler and Make 来自淘豆网www.taodocs.com转载请标明出处.