Multiple Source File Question

BlitzMax Forums/BlitzMax Programming/Multiple Source File Question

Hi, my current project has multiple source files and I have a constant that is in several of the source files, used by several functions.

all the source files are to be imported in the main file.

e.g.
filea.bmx

const COMPLETE : int = 1


fileb.bmx

const COMPLETE : int = 1


main.bmx

import "filea.bmx"
import "fileb.bmx"

const COMPLETE : int = 1



This when compiled gives a duplicate identifier error. Is there anyway round this, apart from using different names for the const?

Cheers.

Add a filex.bmx which holds your consts.
Let filea.bmx and fileb.bmx import it.
the main file, which imports filea and fileb doesn't need to import the consts file, since the others do.

No - you can't define the same constant three times. No way around it.

Without knowing what you're trying to do its difficult to suggest an alternative solution.

Ah, cheers simple as that eh.

I take it there is no reason why the main file could not import 'filex' as well (it seems to compile ok like that)

Thanks.

np :-)