VC judges whether it is a 32-bit compilation or a 64-bit compilation, and determines whether it is a debug compilation or a release compilation.

Source: Internet
Author: User
  • Source: http://www.greensoftcode.net/Release Date: 2014-03-28 clicks: 471 publisher IP: 119.119.236.22
    • 1. Determine whether it is debug or release compilation.
      If _ debug is defined, it indicates debug compilation; otherwise, it indicates release compilation.


      2. Determine whether to perform 32-bit or 64-bit compilation.
      In Win32 configuration, _ Win32 is defined, and _ win64 is not defined. In x64 configuration, both are defined. In VC, _ Win32 must be defined.
      Therefore, Win32/_ Win32 can be used to determine whether a Windows system (for cross-platform programs), while _ win64 can be used to determine whether the compiling environment is x86 or x64. A table is attached:


      Constant \ define predefined options windows. h VC Compiler
      Win32 Win32 √ (minwindef. h) ×
      _ Win32 ××√
      _ Win64 ×× x64


      Finally, the following example code is provided to link the corresponding static library with conditions based on the Compilation conditions. It is actually the use of some macro definition statements:
      # Include "JSON/JSON. H"
      # Ifdef _ debug
      # Ifndef _ win64
      # Pragma comment (Lib, "JSON/json_mtd.lib ")
      # Else
      # Pragma comment (Lib, "JSON/json_mtd_x64.lib ")
      # Endif
      # Else
      # Ifndef _ win64
      # Pragma comment (Lib, "JSON/json_mt.lib ")
      # Else
      # Pragma comment (Lib, "JSON/json_mt_x64.lib ")
      # Endif
      # Endif


      # Ifndef _ win64
      Afx_msg void ontimer (uint nidevent );
      # Else if
      Afx_msg void ontimer (uint_ptr nidevent );
      # Endif

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.