# #pragma

`#pragma` was introduced to remove dependency on [#ifdef](/_/cpp/code/pre-processors/ifdef.md) for solely including header file.

```cpp
// In myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H

// Header contents go here

#endif // MYHEADER_H
```

Above, as we can see here we are using `#ifndef` for including header files only once, but here we need to declare a Macro = `MYHEADER_H` to chieve this.

To overcome this unnecessary creation of a Macro, we can use `#pragma once` which does the same thing without declaring any Macro.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.tejpratapsingh.com/_/cpp/code/pre-processors/pragma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
