Each implementation of C and C ++ supports some unique features for its host or operating system.
For example, some programs must precisely control the storage area where data is stored, or control the way a specific function accepts parameters.
#
# Pragma once is guaranteed by the compiler: the same file will not be contained multiple times. Note that the "same file" here refers to a physical file, not two files with the same content. The advantage is that you don't have to think about a
Resolution # pragma command
Among all the pre-processing commands, the # pragma command may be the most complex. It is used to set the compiler status or to instruct the compiler to complete some specific actions. # The Pragma command provides a
Pragma preprocessing instructionsPragma instructionsWhen coding, we often use the # pragma command to set the compiler status or instruct the compiler to complete some specific actions.The following describes some frequently used counters of this
Pragma preprocessing instructions
Pragma instructions
CompileProgramWe often use the # pragma command to set the compiler status or instruct the compiler to complete some specific actions.
The following describes some common parameters of
#pragma comment ( comment-type [, "commentstring"]) The macro places a comment into the object file or executable file.Comment-typeis a predefined identifier that specifies the type of comment, which should
#pragma预处理命令The most complex preprocessing directives #pragma可以说是C + +, the following are the most commonly used #pragma directives:#pragma comment (lib, "XXX.lib")Indicates that the link XXX.lib this library, and is written in the project settings
# Pragma is the most complex preprocessing command in C ++. The following are the most common commands # pragma commands:
# Pragma comment (Lib, "XXX. lib ")
Link to the library XXX. Lib, which is the same effect as writing XXX. Lib in the Project
Precompiled command # pragma usage
Recently, when I was looking at the code in an open-source project, I found that the # pragma program was used in many places. Therefore, I asked a Google instructor and summarized the common usage of the # pragma
#Pragma是预处理指令, its role is to set the state of the compiler or instruct the compiler to perform certain actions.
#Pragma指令对每个编译器给出了一个方法, to give the host or operating system proprietary features, while maintaining complete compatibility with the C
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.