Im working on a project and i need to use the functions of a dll. So i put all the declarations of the functions in the dll in a include file (.inc).
I need to use that functions in various sources (.eba) of the project, so in theory i need to include the .inc in every source. But then when i try to compile i get a "duplicate declaration" of every declared function.
In C, to avoid this, exists the commands:
#ifndef souce_h
#define source_h
means include the source only is not was included before.
In EB is a way to do this?
Thank you and sorry for my english :)
ok, i play with the code to see wath's wrong...
suppose:
myinclude.inc
source1.eba
source2.eba
source3.eba
if i include "myinclude.inc" in the sources no problem and compiles ok.
But if i have:
myinclude.inc
source1.eba
source1.inc
source2.eba
source2.inc
source3.eba
source3.inc
and i include "myinclude.inc" in the others inc appears "duplicate declaration".
So, in definitive, we can repeat an include in various sources, but we can't repeat an include in others includes.
You can use these preprocessor commands in Ebasic :
$ifndef ....
$define ...
For more info, see the "Conditional Compiling" chapter in user guide.
By the way, if you create a project using the IDE options, I think the proper thing to do is to include the headers as part of the project only once
then the compiler and linker will do the rest of the job.