Lets say my program spans across numerous .c files. How to I compile all those .c files into one program. I am using Borland 3.1.
Is there a term for compiling many .c files into one program?
Lets say my program spans across numerous .c files. How to I compile all those .c files into one program. I am using Borland 3.1.
Is there a term for compiling many .c files into one program?
> Is there a term for compiling many .c files into one program?
Modularization.
Look at your compiler's documents on how to do this.
You usually compile the source files individually.
Your linker then links the output files together into a file name specified by you.
This is your executable program.
The world is waiting. I must leave you now.
Just compile all of the files together.
-Prelude
My best code is written with the delete key.
You will need to use
extern
for global variables.
Declare them in one file, if needed in another they are declared in the second file preceeded with 'extern'
ie
first file
int iVar;
second file for same variable
extern int iVar;
This tells the compiler to look in the other files for the variables declaration.
Conditional compilation will also be needed for global structs declaration ect in header files included in more than one file. So you don't have to declare a struc ect in more than one place. (roughly)
#ifndef MY_STRUCTS// if MY_STRUCTS is undefined
#define MY_STRUCTS//define MY_STRUCTS so will be next file
//write header file
#endif//end of the if undefined statement
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill