#pragma once

BlitzMax Forums/BlitzMax Programming/#pragma once

Will(Posted 2006) [#1]
Is there an equivalent to #pragma once or something like that, that will let me call Include more than once on a file, and not cause a problem? I have a project with 70 source files, its getting to be a huge pain every time i write a test to have to search out all the dependencies and include them all, I'd like each file to have its own includes, so I can just include Spaceship.bmx and that will include physics, graphics, etc.


SculptureOfSoul(Posted 2006) [#2]
I've found the easiest way is to create a blank "framework" bmx file that simply includes all of the files you need, and then simply import that framework file in your test programs.

It's convoluted, sure, as are any of the other workarounds, unfortunately.


Dreamora(Posted 2006) [#3]
In that case, do what "include" in C actually does: Use Import.

As Import is handled by the linker, this is no problem. The same source won't be linked more than once to the executable.


What you try to do with include isn't possible anyway, because include must be written at the top of the file. So an included file can't include / import / strict anything normally.


Will(Posted 2006) [#4]
Thanks :D