Macros commonly used in VC [conversion]

Source: Internet
Author: User
We encounter many macro definitions during development in the vs environment. These macros can be applied to code or used for compilation, engineering options, and other settings, in short, it is an essential tool in our development, and it is necessary to make a summary. Some macros are defined in C/C ++, and some macros are predefined in the VC environment. 1. Macros in C/C ++ _ CplusplusIf the current compiler is C ++, the value is 1. _ Date __The compilation date of the current source code, in the format of MMM dd YYYY. _ Time __The Compilation Time of the current source code, in the format of HH: mm: Ss. _ Timestamp __The Last modified Date and time of the source code file, in the format of DDD Mmm date hh: mm: ss yyyy. _ File __The file name of the current source code. _ Line __The source code number of the current insertion point. _ Function __Function Name of the current insertion point. _ Stdc __Whether the identifier strictly complies with the ansi c standard. When the compiler option/Za is set, the macro is defined as 1, indicating that it complies with the standard. _ Va_args __A Variable Parameter macro is used to pass a variable parameter table. This macro is not supported by all compilers. 2. Macros in VC _ DebugWhen our project is set to debug, the compiler will define this macro. This macro is used together with pre-compiled statements such as # ifdef for Conditional compilation to differentiate the debug and release versions. AssertAsserted that when the statement value after the macro is 0, the program is interrupted and only valid in the debug version. VerifySimilar to the assert function, it is valid in both Debug and release versions. Assert_validCheck whether the parameter pointer is null. It is only valid in debug. TraceFormat the output string. _ Atl_verSpecifies the ATL version. _ Clr_verSpecifies the version of common language runtime. _ Counter _A Global Counter starting from 0 is automatically added with 1 each time it is used for source files or header files referenced in the source files. _ DLLThis value is 1 when the project type is dynamic link library. WinverIndicates the Windows version. _ Mfc_verIndicates the MFC version. _ Msc_verIndicates the compiler version. _ Win32It is defined for Win32 and win64 programs. 3. VC ide predefined macrosThese macros are mainly used in project property settings, including names, paths, compilation, and other related strings. For example, the solution bit c: \ soln. SLN. The project is located in c: \ soln \ proj. vcproj, the intermediate directory is debugint, and the output directory is c: \ myoutputs. When the output name is game.exe, the macro values are as follows. $ (Configurationname)Version name, such as debug or release. $ (Platformname)The current platform name, such as Win32. $ (Intdir)The name of the intermediate directory, that is, the directory path of the intermediate file relative to the project directory. The value is debugint. $ (Outdir)Path of the output file directory. The value is c: \ myoutputs. $ (Devenvdir)The installation directory of. $ (Inputdir)Enter the file directory with the value c: \ soln \ proj. $ (Inputpath)The full path name of the input file. The value is c: \ soln \ proj. vcproj. $ (Inputname)Enter the file name and the value is proj. $ (Inputfilename)Enter the file name (with a suffix) with the value proj. vcproj. $ (Inputext)The input file name extension. The value is. vcproj. $ (Projectdir)Project directory, same as $ (inputdir ). $ (Projectpath)Full Project path name, same as $ (inputpath ). $ (Projectname)Same as $ (inputname ). $ (Projectfilename)The same as $ (inputfilename ). $ (Projectext)Same as $ (projectext ). $ (Solutiondir)Solution directory, value: C: \ soln. $ (Solutionpath)Solution path. Value: C: \ soln. sln. $ (Solutionname)Solution name; Value: soln. $ (Solutionfilename)Solution name (with suffix) with the value of soln. sln. $ (Solutionext)Solution file extension, value:. sln. $ (Targetdir)Directory of the output file. The value is c: \ myoutputs \. $ (Targetpath)Path Name of the output file, c: \ myoutputs \ game.exe. $ (Targetname)Output file name. The value is game. $ (Targetfilename)The value of the output file is game.exe. $ (Targetext)The extension name of the output file. The value is .exe. $ (Vsinstalldir)Vs installation directory. $ (Vcinstalldir)VC installation directory. $ (Frameworkdir)Framework installation directory. $ (Frameworkversion)Framework Version Information. $ (Frameworksdkdir)Framework SDK installation directory. From: http://blog.sina.com.cn/s/blog_48f93b530100l0jd.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.