Ask coding questions

← Back to all posts
how do i make the main file a header file
jnrchewie

it is warning me that the main file is not a header file and that i cannot use a #pragma once because of this

Voters
jnrchewie
Comments
hotnewtop
DynamicSquid

You can not use #pragma once in .cpp files, only in .h files

jnrchewie

@DynamicSquid but .h files don't work and the pragma once is needed to stop a loop

DynamicSquid

@jnrchewie no, .h files are for declarations, and .cpp file are for implementations like this:

It gets a little complicated, so you can instead just use a .h file like this: