linux查看編譯器版本
gcc -v 很簡答的一個知識。 所有的linux程序都可以使用這個命令查看版本信息。 以後要是遇到了linux方面的問題, shell編程, linux系統管理問題, 都可以幫到大家。 希望~~
B. 怎麼查看linux 安裝的C++版本號
centos下查看內核版本: 1,如下命令適合於linux所有發行版本或其它unix版本比如 FreeBSD, OpenBSD, Solaris, HP UX etc. $ uname -r 2,另一種通用的方法: $ uname -mrsn
C. 如何查看程序被哪個版本編譯器編譯的linux-gcc
那是不可能的,除非你加入了調試信息,也就是編譯的時候加入了-g參數,然後用gdb調試就可以顯示。最大程度上查看一個elf文件信息。
{
readelf -Wa a.out | head
readelf -wi a.out
readelf -p .comment a.out
objmp -s --section .comment audioplayer
}
如下:
[root@localhost rootfs]#  readelf -Wa bin/gzip 
復制代碼
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0xa080
  Start of program headers:          52 (bytes into file)
  Start of section headers:          1975444 (bytes into file)
  Flags:                             0x5000002, has entry point, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         25
  Section header string table index: 24
Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .note.ABI-tag     NOTE            000080f4 0000f4 000020 00   A  0   0  4
  [ 2] .init             PROGBITS        00008114 000114 00000c 00  AX  0   0  4
  [ 3] .text             PROGBITS        00008120 000120 17fcfc 00  AX  0   0 16
  [ 4] __libc_freeres_fn PROGBITS        00187e1c 17fe1c 000f20 00  AX  0   0  4
  [ 5] __libc_thread_fre PROGBITS        00188d3c 180d3c 0000e4 00  AX  0   0  4
  [ 6] .fini             PROGBITS        00188e20 180e20 000008 00  AX  0   0  4
  [ 7] .rodata           PROGBITS        00188e28 180e28 058147 00   A  0   0  8
  [ 8] __libc_subfreeres PROGBITS        001e0f70 1d8f70 00005c 00   A  0   0  4
  [ 9] __libc_atexit     PROGBITS        001e0fcc 1d8fcc 000004 00   A  0   0  4
  [10] __libc_thread_sub PROGBITS        001e0fd0 1d8fd0 000008 00   A  0   0  4
  [11] .ARM.extab        PROGBITS        001e0fd8 1d8fd8 001b04 00   A  0   0  4
  [12] .ARM.exidx        ARM_EXIDX       001e2adc 1daadc 006ea8 00  AL  3   0  4
  [13] .tdata            PROGBITS        001f1984 1e1984 000018 00 WAT  0   0  4
  [14] .tbss             NOBITS          001f199c 1e199c 000034 00 WAT  0   0  4
  [15] .init_array       INIT_ARRAY      001f199c 1e199c 000004 00  WA  0   0  4
  [16] .fini_array       FINI_ARRAY      001f19a0 1e19a0 000008 00  WA  0   0  4
  [17] .jcr              PROGBITS        001f19a8 1e19a8 000004 00  WA  0   0  4
  [18] .data.rel.ro      PROGBITS        001f19ac 1e19ac 00002c 00  WA  0   0  4
  [19] .got              PROGBITS        001f19d8 1e19d8 00007c 04  WA  0   0  4
  [20] .data             PROGBITS        001f1a58 1e1a58 0008f7 00  WA  0   0  8
  [21] .bss              NOBITS          001f2350 1e234f 004828 00  WA  0   0  8
  [22] __libc_freeres_pt NOBITS          001f6b78 1e234f 00003c 00  WA  0   0  4
  [23] .ARM.attributes   ARM_ATTRIBUTES  00000000 1e234f 00002b 00      0   0  1
  [24] .shstrtab         STRTAB          00000000 1e237a 000118 00      0   0  1
 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx
   01     .note.ABI-tag .init .text __libc_freeres_fn __libc_thread_freeres_fn .fini .rodata __libc_subfreeres __libc_atexit __libc_thread_subfreeres .ARM.extab .ARM.exidx
   02     .tdata .init_array .fini_array .jcr .data.rel.ro .got .data .bss __libc_freeres_ptrs
   03     .note.ABI-tag
   04     .tdata .tbss
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "5TE"
  Tag_CPU_arch: v5TE
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align8_needed: Yes
  Tag_ABI_align8_preserved: Yes, except leaf SP
  Tag_ABI_enum_size: int
  Tag_unknown_44: 1 (0x1)
復制代碼
How to retrieve the GCC version used to compile a given ELF executable? http://stackoverflow.com/questions/2387040/how-to-retrieve-the-gcc-version-used-to-compile-a-given-elf-executable
QUES: I'd like to retrieve the GCC version used to compile a given executable. I tried readelf but didn't get the information. Any thoughts?
ANS: To complete what others have said: it's not stored in the object (or exe) file, unless you compile with debugging information! (option -g). If you compile with debug info, you can get it back with readelf:
復制代碼
[root@localhost test]# gcc a.c
[root@localhost test]# readelf -wi a.out
[root@localhost test]# gcc a.c -g 
[root@localhost test]# readelf -wi a.out
The section .debug_info contains:
  Compilation Unit @ offset 0x0:
   Length:        135
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0
     DW_AT_high_pc     : 0x400453
     DW_AT_low_pc      : 0x400448
     DW_AT_procer    : GNU C 4.1.2 20080704 (Red Hat 4.1.2-55)
     DW_AT_language    : 1      (ANSI C)
     DW_AT_name        : a.c
     DW_AT_comp_dir    : /work/farsight/test
 <1><61>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_external    : 1
     DW_AT_name        : main
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 4
     DW_AT_prototyped  : 1
     DW_AT_type        : <83>
     DW_AT_low_pc      : 0x400448
     DW_AT_high_pc     : 0x400453
     DW_AT_frame_base  : 0      (location list)
 <1><83>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 5      (signed)
復制代碼
ANS2:
D. linux如何查看是否已安裝GCC
執行gcc -v命令,如果Linux系統沒有安裝gcc編譯器,會提示「Command not found」。
1、如果系統上安裝了gcc編譯器,這條命令就會顯示出當前安裝的gcc編譯器是哪個版本。如下:

(4)linux查看編譯器版本擴展閱讀:
安裝GCC的必要事項:
GCC可以用來編譯C/C++、FORTRAN、Java、OBJC、ADA等語言的程序,可根據需要選擇安裝支持的語言。
安裝之前,系統中必須要有cc或者gcc等編譯器,並且是可用的,或者用環境變數CC指定系統上的編譯器。如果系統上沒有編譯器,不能安裝源代碼形式的GCC 4.1.2。如果是這種情況,可以在網上找一個與系統相適應的如RPM等二進制形式的GCC軟體包來安裝使用。
系統上原來的GCC編譯器可能是把gcc等命令文件、庫文件、頭文件等分別存放到系統中的不同目錄下的。
與此不同,現在GCC建議將一個版本的GCC安裝在一個單獨的目錄下。這樣做的好處是將來不需要它的時候可以方便地刪除整個目錄即可(因為GCC沒有uninstall功能);缺點是在安裝完成後要做一些設置工作才能使編譯器工作正常。
E. linux怎麼用命令行查看編譯器版本
一般的方式是
左上角的
applications===>附件==>terminal(中文版本叫終端)
比較人性化的linux版本里可以在桌面上點右鍵就有這個選項(不是每個linux發行版本都有的)
F. 怎麼查看編譯器版本
你的是什麼編譯程序?
MYTC?
TC?
GCC?
GPP?
.... 
在VISUAL STUDIO命令提示里輸入
RC /?
第一行
Microsoft (R) Windows (R) Resource Compiler Version 5.2.3690.0
5.2.3690.0就是版本號了
G. 如何查看linux的cmake編譯器的最低版本
可以使用cmake --version  查看
如果輸出 cmake的版本號說明已經正確安裝了cmake
如果提示沒有cmake這個命令,說明沒有正確安裝
下面給出安裝cmake的步驟
可以直接在線安裝:apt-get install cmake  
   2. 離線安裝
cmake下載地址:http://www.cmake.org/files/v2.8/cmake-2.8.4-Linux-i386.tar.gz
下載之後
1.解壓
    root@zsh-linux:/opt#tar -zxvf  cmake-2.8.4.tar.gz  
2.然後 cd 到cmake-2.8.4目錄下  安裝
    root@zsh-linux:/opt/cmake-2.8.4# ./bootstrap   
    root@zsh-linux:/opt/cmake-2.8.4# make  
    root@zsh-linux:/opt/cmake-2.8.4# make install   
安裝完畢後查看是否安裝成功:  
root@zsh-linux:/opt/cmake-2.8.4# cmake --version  
   cmake version 2.8.4
H. 怎麼查看linux庫是使用哪個版本的編譯器編
如果是你自己編譯的 那麼gcc -v 查看本機版本號。
如果是你拿到的別人的,可以
objmp-s--section=.commentyour_program
查看程序編譯器版本
I. 如何查看linux已安裝的編譯器及其版本
gcc -v、rpm -qa glibc、rpm -qa zlib。
FC6可以用這些命令,rpm -qa gcc glibc zlib。
補充:Linux是一套免費使用和自由傳播的類Unix操作系統,是一個基於POSIX和UNIX的多用戶、多任務、支持多線程和多CPU的操作系統。它能運行主要的UNIX工具軟體、應用程序和網路協議。它支持32位和64位硬體。Linux繼承了Unix以網路為核心的設計思想,是一個性能穩定的多用戶網路操作系統。
Linux操作系統誕生於1991 年10 月5 日(這是第一次正式向外公布時間)。Linux存在著許多不同的Linux版本,但它們都使用了Linux內核。Linux可安裝在各種計算機硬體設備中,比如手機、平板電腦、路由器、視頻游戲控制台、台式計算機、大型機和超級計算機。
嚴格來講,Linux這個詞本身只表示Linux內核,但實際上人們已經習慣了用Linux來形容整個基於Linux內核,並且使用GNU 工程各種工具和資料庫的操作系統。

