Solved

compiling using borland or djgpp

Posted on 2003-11-05
11
406 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
  • 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now