Select header file type

Source: Internet
Author: User

The header files in C ++ can be defined as. h and. HPP.

. H files can generally have Data Type Definitions and function declarations. The HPP file can contain data types, function declarations, and function definitions.

When using HPP, you must note that the error Link 2005 error is reported when multiple files reference HPP. The reason is that the compiler will compile the included header file when compiling the CPP file. HPP has defined functions in the file and will also be compiled into the OBJ file. If other CPP also calls this HPP file, the functions in the HPP file will be compiled into multiple OBJ files, the compiler does not report an error during compilation, but a link error occurs when obj is generated for an EXE file.

In this case, use. h instead.

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.