Solved

compiling using borland or djgpp

Posted on 2003-11-05
11
416 Views
Last Modified: 2010-04-17
hi to all
how could i compile more than one file using borland or
djgpp compiler for c++.
thanks in advance
0
Comment
Question by:egy1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
11 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9686145
Add them to a project.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9686157
In bc31 'Project->Open Project'
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9686300
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:egy1
ID: 9686817
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
0
 
LVL 11

Accepted Solution

by:
bcladd earned 100 total points
ID: 9686922
It looks like you have a MS VC.Net (or VC6) project. _IF_ it compiles with bcc, you'll want to list all of the .cpp files on the command-line.

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

There is one exception: If your project uses templates, some programmers put implementation for templated funcitons into a .cpp file and then #include the .cpp file back into the header file. You do NOT want such .cpp files compiled separately.

Note that since this is a MS project, there may be additional build steps that are not accomplished by a simple call to bcc32 ( resource file compilation comes to mind). Porting a package to/from the MS IDE can be a real challenge. Since you downloaded the package, you might want to see if the homepage for the package has any guidance (or already ported versions) available.

-bcl
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9687855
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
0
 

Author Comment

by:egy1
ID: 9687883
i made my request before i got any comment but now there is no need for deleting this question.

0
 

Author Comment

by:egy1
ID: 9687955
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?
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9688014
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.
0
 

Author Comment

by:egy1
ID: 9688404
many thanks again for your help
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 74
Developing a front end to SPLUNK 1 56
Is online banking safe? 11 84
How to delete text box content on subform 1 17
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question