VC編譯選項

2021-04-12 21:39:53 字數 4565 閱讀 8049

vc編譯選項

/od 禁用優化(預設值) disable optimizations (default)

/ox 最大化選項。(/ogityb2 /gs) maximum opts. (/ogityb1 /gs)

/og 啟用全域性優化 enable global optimization

/oy[-] 啟用框架指標省略 enable frame pointer omission

/oi 啟用內建函式 enable intrinsic functions

-**生成-

/g3 為 80386 進行優化 optimize for 80386

/g4 為 80486 進行優化 optimize for 80486

/gr[-] 啟用 c++ rtti enable c++ rtti

/g5 為 pentium 進行優化 optimize for pentium

/g6 為 pentium pro 進行優化 optimize for pentium pro

/gx[-] 啟用 c++ 異常處理(與 /ehsc 相同) enable c++ eh (same as /ehsc)

/ehs 啟用同步 c++ 異常處理 enable synchronous c++ eh

/gd 為 windows dll 進行優化 optimize for windows dll

/gb 為混合模型進行優化(預設) optimize for blended model (default)

/eha 啟用非同步 c++ 異常處理 enable asynchronous c++ eh

/gd __cdecl 呼叫約定 __cdecl calling convention

/ehc extern「c」預設為 nothrow extern "c" defaults to nothrow

/gr __fastcall 呼叫約定 __fastcall calling convention

/gi[-] 啟用增量編譯 enable incremental compilation

/gz __stdcall 呼叫約定 __stdcall calling convention

/gm[-] 啟用最小重新生成 enable minimal rebuild

/gf 啟用字串池 enable string pooling

/qifdiv[-] 啟用 pentium fdiv 修復 enable pentium fdiv fix

/gf 啟用唯讀字串池 enable read-only string pooling

/qi0f[-] 啟用 pentium 0x0f 修復 enable pentium 0x0f fix

/gy 分隔鏈結器函式 separate functions for linker

/gz 啟用執行時除錯檢查 enable runtime debug checks

/gh 啟用鉤子函式呼叫 enable hook function call

/ge 對所有函式強制堆疊檢查 force stack checking for all funcs

/gs[num] 禁用堆疊檢查呼叫 disable stack checking calls

-輸出檔案-

/fa[file] 命名程式集列表檔案 name assembly listing file

/fo 命名物件檔案 name object file

/fa[sc] 配置程式集列表 configure assembly listing

/fp 命名預編譯標頭檔案 name precompiled header file

/fd[file] 命名 .pdb 檔案 name .pdb file

/fr[file] 命名源瀏覽器檔案 name source browser file

/fe 命名可執行檔案 name executable file

/fr[file] 命名擴充套件 .sbr 檔案 name extended .sbr file

/fm[file] 命名對映檔案 name map file

-預處理器-

/fi 命名強制包含檔案 name forced include file

/c 不吸取注釋 don't strip comments

/u 移除預定義巨集 remove predefined macro

/d 定義巨集 define macro

/u 移除所有預定義巨集 remove all predefined macros

/e 將預處理定向到標準輸出 preprocess to stdout

/i 新增到包含檔案的搜尋路徑 add to include search path

/ep 將預處理定向到標準輸出,不要帶行號 preprocess to stdout, no #line

/x 忽略「標準位置」 ignore "standard places"

/p 預處理到檔案 preprocess to file

-語言-

/zi 啟用除錯資訊 enable debugging information

/zl 忽略 .obj 中的預設庫名 omit default library name in .obj

/zi 啟用除錯資訊的「編輯並繼續」功能 enable edit and continue debug info

/zg 生成函式原型 generate function prototypes

/z7 啟用舊式除錯資訊 enable old-style debug info

/zs 只進行語法檢查 syntax check only

/zd 僅要行號除錯資訊 line number debugging info only

/vd 禁用/啟用 vtordisp disable/enable vtordisp

/zp[n] 在 n 位元組邊界上包裝結構 pack structs on n-byte boundary

/vm 指向成員的指標型別 type of pointers to members

/za 禁用擴充套件(暗指 /op) disable extensions (implies /op)

/nobool 禁用「bool」關鍵字 disable "bool" keyword

/ze 啟用擴充套件(預設) enable extensions (default)

- 雜項 -

/?, /help 列印此幫助訊息 print this help message

/c 只編譯,不鏈結 compile only, no link

/w 設定警告等級(預設 n=1) set warning level (default n=1)

/h 最大化外部名稱長度 max external name length

/j 預設 char 型別是 unsigned default char type is unsigned

/wx 將警告視為錯誤 treat warnings as errors

/tc 將檔案編譯為 .c compile file as .c

/yc[file] 建立 .pch 檔案 create .pch file

/tp 將檔案編譯為 .cpp compile file as .cpp

/yd 將除錯資訊放在每個 .obj 中 put debug info in every .obj

/tc 將所有檔案編譯為 .c compile all files as .c

/tp 將所有檔案編譯為 .cpp compile all files as .cpp

/yu[file] 使用 .pch 檔案 use .pch file

/v 設定版本字串 set version string

/yx[file] 自動的 .pch 檔案 automatic .pch

/w 禁用所有警告 disable all warnings

/zm 最大記憶體分配(預設為 %) max memory alloc (% of default)

-鏈結-

/md 與 msvcrt.lib 鏈結 link with msvcrt.lib

/mdd 與 msvcrtd.lib 除錯庫鏈結 link with msvcrtd.lib debug lib

/ml 與 libc.lib 鏈結 link with libc.lib

/mld 與 libcd.lib 除錯庫鏈結 link with libcd.lib debug lib

/mt 與 libcmt.lib 鏈結 link with libcmt.lib

/mtd 與 libcmtd.lib 除錯庫鏈結 link with libcmtd.lib debug lib

/ld 建立 .dll create .dll

/f 設定堆疊大小 set stack size

/ldd 建立 .dll 除錯庫 create .dll debug libary

/link [鏈結器選項和庫] [linker options and libraries] 

VC編譯選項

今天練習vc編譯選項設定。現在有三個工程a b和c a和b是鏈結庫,c是exe的demo程式。b呼叫a,c呼叫b。1.最初的編譯是 a b編為動態庫,並生成lib,c包含這個lib,生成exe。這樣是簡單的,c的專案設定link屬性頁 category為input的選項中,填入a與b的lib就可以了...

VC編譯選項 MT MTd MD MDd

vc編譯選項 多執行緒 mt 多執行緒除錯 mtd 多執行緒 dll md 多執行緒除錯 dll mdd c 執行時庫 庫檔案 single thread static link ml libc.lib debug single thread static link mld libcd.lib mu...

VC編譯選項md mdd ml mt mtd

vc編譯選項 多執行緒 mt 多執行緒除錯 mtd 多執行緒 dll md 多執行緒除錯 dll mdd c 執行時庫 庫檔案 single thread static link ml libc.lib debug single thread static link mld libcd.lib mu...