Solved

compiling using borland or djgpp

Posted on 2003-11-05
11
411 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
changePi Challenge 15 107
Recommendation vb6 to vb.net or others 14 114
Programatically extract date from website 8 68
egit plugin on eclipse 8 41
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 …
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

23 Experts available now in Live!

Get 1:1 Help Now