Projects with multiple files

BlitzMax Forums/BlitzMax Beginners Area/Projects with multiple files

Mogwins(Posted 2006) [#1]
Hello all,

Just bought BlitzMax after deciding C++ really was too much of a headache for game development.

Anyway, I wondered if anybody could point in the direction of how to use the IDE to manage projects with multiple files. E.g., how do I let "main.bmx" access my list of global variables in "globals.bmx"? I can't seem to find anything.

Thanks in advance, Matt.


REDi(Posted 2006) [#2]
Welcome Mogwins

Include "globals.bmx"



Mogwins(Posted 2006) [#3]
Thanks, I just found that with the BLIde on-line help.

Do I need to worry about multiple dependencies? In C++, I'd put...

"
#ifndef _GLOBALS_
#define _GLOBALs_

#include "otherdependences.h"
"

at the start of each file.


H&K(Posted 2006) [#4]
If you are using the project settings in Blide you dont even need the Include. Whatever you say is a project file is included automaticaly in the order you declare them as project files


Mogwins(Posted 2006) [#5]
Hmmm, I am using the BLIde project settings and both files are included, but I need the

Include "globals.bmx"

line in order to avoid a compiler error. It's not really a bit deal, but any idea why?


kfprimm(Posted 2006) [#6]
because BlitzMax is set up differently than C++, it compiles one file and checks for imports and includes in the file and then compiles them and links them to the file.

you can also use the Import command. When using Import, if the compiler doesn't detect any changes in the imported file, it won't recompile it.


ziggy(Posted 2006) [#7]
Using BLIde:
I recomend you to add a:

Import "globals.bmx"

at the begining of your main program BMX file, and you'll get done.

the project manager in BLIde is there to create projects that generate more than one exe or module. If your project has only a program (with one or more BMX files), just add the appropiate include or incbin in the main bmx file, and any other included file will be also loaded when opening the project.


Mogwins(Posted 2006) [#8]
Ah, thanks, I'll do that.