[VC++] Determinare versiune Visual C++

Mediul de dezvoltare Visual C++, instalare, setari, debugger, compilator, linker si documentatie (forum moderat)
Post Reply
User avatar
Ovidiu Cucu
Fondator
Fondator
Posts: 3776
Joined: 11 Jul 2007, 16:10
Judet: Iaşi
Location: Iasi
Contact:

[VC++] Determinare versiune Visual C++

Post by Ovidiu Cucu » 09 Mar 2008, 22:52

Intrebare
Cum aflu in program versiunea de Visual C++ ?

Raspuns
Simplu, cu ajutorul macro-ului predefinit _MSC_VER
Exemplul urmator afiseaza la compilare versiunea in fereastra output.

Exemplu

Code: Select all

#if _MSC_VER <  700
#pragma message("MS C version is too much early to my experience")
#elif _MSC_VER <  800
#pragma message("MS C++ 7.x")
#elif _MSC_VER <  900
#pragma message("VC++ 1.x")
#elif _MSC_VER < 1000
#pragma message("VC++ 2.x")
#elif _MSC_VER < 1100
#pragma message("VC++ 4.x")
#elif _MSC_VER < 1200
#pragma message("VC++ 5.x")
#elif _MSC_VER < 1300
#pragma message("VC++ 6.x")
#elif _MSC_VER < 1400
#pragma message("VC++ 7.x")
#elif _MSC_VER < 1500
#pragma message("VC++ 8.x")
#elif _MSC_VER < 1600
#pragma message("VC++ 9.x")
#elif _MSC_VER < 1700
#pragma message("VC++ 10.x")
#else
#pragma message("Beware of the code - it was designed to outdated VC versions years ago!")
#endif
[ originally posted by Igor Vartanov (Codeguru) ]


Next FAQ >>



Post Reply