[問題] [200P] 如何在 Code 裡面判別 VC 版本?

看板C_and_CPP作者 (咚薯叔)時間11年前 (2013/05/17 07:05), 編輯推噓2(202)
留言4則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC6, VC2008 問題(Question): 因為有的人用 VC6, 有的人用 VC2008 但是 VC2008 有些東西 VC6 不會過 想說有沒有甚麼辦法用類似 #ifdef 這種 condition compiler 的方式判別 如果是 VC6 跑一種,VC2008 跑另一種 以下用 strcat_s 作例子 餵入的資料(Input): strcat_s 預期的正確結果(Expected Output): 讓 VC2008 跑 strcat_s,VC6 跑 strcat 程式碼(Code):(請善用置底文網頁, 記得排版) #ifdef ??? // VC2008 strcat_s 是 strcat_s #else // VC6 strcat_s 是 strcat #endif 補充說明(Supplement): 第一位幫忙的人送 200P 獎金。謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 180.177.104.226

05/17 07:14, , 1F

05/17 08:52, , 2F
P幣已經送出,請查收,謝謝
05/17 08:52, 2F

05/17 12:26, , 3F
我比較推薦使用std標準函式庫比較有彈性
05/17 12:26, 3F

05/18 22:32, , 4F
use _MSC_VER
05/18 22:32, 4F
文章代碼(AID): #1HbMOwei (C_and_CPP)