Gcc/g ++ compiler and some predefined macros and user-defined Macros in vs ide

Source: Internet
Author: User

Predefined macros,

Compilers usually provide different predefined macros for compiled programs based on different platforms and compilation options,

For example, Win32 win64 Linux, such as debug and release.

1. When using the GCC/g ++ compiler, you can run the following command to print the macros pre-compiled by the compiler.

Gcc-DM-e-</dev/null

2. For details about vs IDE, see http://msdn.microsoft.com/zh-cn/library/b0084kay.


In addition to the predefined macros, the compiler also allows,Custom macros:

1. When using the GCC/g ++ compiler, add a custom macro by adding the-D option.

Example: G ++-O test-D userm test. cpp

In this way, the userm macro definition is added before the test. cpp is preprocessed.

2. In vs IDE, you can click the properties page of the project, select the C ++ page option, click Preprocessor, and add your own macros to The Preprocessor definitions on the right,

Similarly, a custom macro is added before project preprocessing.


Refer:

Http://jmpcn.bokee.com/5772194.html

Http://msdn.microsoft.com/zh-cn/library/b0084kay

Http://jishudaima.iteye.com/blog/955083

Http://msdn.microsoft.com/en-us/library/y4skk93w (V = vs.80). aspx

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.