#pragma once是什么
时间: 2023-09-26 13:07:03 浏览: 93
#pragma once是一个编译指令,用于头文件中。它的作用是确保头文件只被编译一次,以防止多次包含同一个头文件导致的重复定义错误。这个指令在大多数编译器上都是有效的,但不是所有编译器都支持。使用#pragma once可以更简洁地避免重复定义的问题。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [#pragma once](https://blog.csdn.net/bingtears/article/details/83613855)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [全面了解#pragma once与 #ifndef的区别](https://download.csdn.net/download/weixin_38714653/13990080)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文