Link to home
Start Free TrialLog in
Avatar of egy1
egy1

asked on

compiling using borland or djgpp

hi to all
how could i compile more than one file using borland or
djgpp compiler for c++.
thanks in advance
Avatar of GloomyFriar
GloomyFriar

Add them to a project.
In bc31 'Project->Open Project'
On the command line (using Borland 5.5 compiler) you can simply list all of the source files you want compiled and linked together:

    bcc32 myMain myDataStructure myPolynomialSolutionToTravellingSalesman

The resulting executable will have the name of the first source file (myMain.exe) or that set with the -o switch.

Alternatively, if you want to do smart recompiles (only make the files that are actually out of date) you can learn to use the make utility (I would urge you to look into getting a port of GNU make as it is powerful, fairly well documented, and free). A makefile is similar to a project file in an IDE.

Hope this helps, -bcl
Avatar of egy1

ASKER

thanks for replay
i'm a bigginer in compiling i know how to compile one file here is the command line
bcc32 -ic:borland\bcc55\ include -Lc:\borland\bcc55\lib file.cpp
but when i download a source code for a program i got many files some files have the .cpp and some other have .h extension
and other extension    .dsp     .dsw    .vbp all these file extension in the same package of the program source code so what is the command line i use to compile such a program.
thanks
ASKER CERTIFIED SOLUTION
Avatar of bcladd
bcladd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am sorry but all of the answers from experts were, at least potentially, correct. If the original poster has solved the problem in another way then it would be wonderful to see their solution (so that others could benefit by searching the PAQ database with this question in it). I would also be interested in which "expert's" comment pointed toward the solution (or none if there is another answer).  With that solution it would make sense to refund the points; without that solution it looks like the poster wanted to pick some brains and then not pay for the advice.

-bcl
Avatar of egy1

ASKER

i made my request before i got any comment but now there is no need for deleting this question.

Avatar of egy1

ASKER

u r so helpfull  bcladd
but the file with .h extension i think the compiler may need it in the code should i copy and past it in the library?
 in this case is the command line will be change?
I am sure the .h file is important but it should NOT appear on the command line. If you downloaded a package the .h files may be in another directory. You will want to add that directory to the command-line using the -i parameter. So, if the package includes a /Src directory and a /Inc directory (could be /src and /include; you'll have to figure some of this out on your machine) and we are compiling in the Src directory (and the .h files are all in the Inc directory), the command-line above would change to

    bcc32 -ic:borland\bcc55\ include -i..\Inc -Lc:\borland\bcc55\lib firstFile.cpp secondFile.cpp thirdFile.cpp

There may be a required order for the source files (you probably want main() first and then the highest-level routines down to the lowest-level routines) so the linker can find the required functions.

Hope this helps, -bcl

PS - Sorry for being snippy when the request for deletion was processed. I am just annoyed with some people who do what I said above. My apologies for impuning your character.
Avatar of egy1

ASKER

many thanks again for your help