Document directory
# Pragma once
You only need to add this command at the beginning of the header file to ensure that the header file is compiled once. This command is actually available in vc6, but it is not widely used in consideration of compatibility. # Pragma once is related to compilation, that is, it can be used in this compilation system, but not necessarily in other compilation systems, that is, it has poor portability, but now, basically every compiler has this definition. # Ifndef, # define, # endif, which is related to the C ++ language. This is a macro definition in the C ++ language. Using the macro definition, you can avoid multiple compilation of files. Therefore, it is effective in all compilers that support the C ++ language. If the program to be written is cross-platform, it is best to use this method.
_ Msc_ver
Define the version of the compiler. The following are the _ msc_ver values of some compiler versions (see references 2 in extended reading)
Ms vc ++ 10.0 _ msc_ver = 1600
Ms vc ++ 9.0 _ msc_ver = 1500
Ms vc ++ 8.0 _ msc_ver = 1400
Ms vc ++ 7.1 _ msc_ver = 1310
Ms vc ++ 7.0 _ msc_ver = 1300
Ms vc ++ 6.0 _ msc_ver = 1200
Ms vc ++ 5.0 _ msc_ver = 1100
Among them, Ms VC ++ 10.0 is Visual C ++ 2010, ms vc ++ 9.0 is Visual C ++ 2008, ms vc ++ 8.0 is Visual C ++ 2005. For the relationship between version names, see the reference 1 link in extended reading.
Adding the _ msc_ver macro to the program allows the compiler to selectively compile a program based on the compiler version. For example, the Lib file generated by a version compiler may not be called by the compiler of another version. When developing an application, put the Lib file generated by multiple version compilers in the Lib call library of this program. When the _ msc_ver macro is added to the program, the compiler can automatically select the Lib library version that can be linked according to its version when calling the program.