[comp.sys.ibm.pc.programmer] linking with Borland-C 2.0

wytten@cs.umn.edu (Dale Wyttenbach) (04/04/91)

I'm trying to compile a program originally written for MSC under BorlandC.
There are approximately 50 object files, which I have compiled with
bcc.  I have two questions that are related.

(1)
When I try to link them, I get the error message:

undefined symbol _main in module c0.asm

There *is* a main() defined in one of the source files.  

(2)
I have tried
to compile the program both with and without Borland's fancy enviroment.
I actually prefer not to use it, because I'm used to the Unix 
enviroment (make, etc).  When I try to link from a makefile with tlink,
it bombs because the command-line arguments are too long.  Is there any
way around this?

Thanks in advance for any clues,

dale
-- 
 Dale Wyttenbach     | We all shine on,
 wytten@cs.umn.edu   | like the moon, the stars and the sun.
                     |                                      --John Lennon

mguyott@eriador.prime.com (04/04/91)

I know of a way around problem (2).  You need to use a "response" file.

What I did in my make file was to add the following:

OBJ=$(OBJ1) $(OBJ2) $(OBJ3)
LFLAGS=Your link flags here!
TARG=Your application name here.
MODEL=Your memory model here.

$(TARG).exe : $(OBJ)
        echo $(LFLAGS) + > tlink.rsp
        echo $(OBJ1)   + >> tlink.rsp
        echo $(OBJ2)   + >> tlink.rsp
        echo $(OBJ3)   + >> tlink.rsp
        tlink c0w$(MODEL) @tlink.rsp, $(TARG).exe, etc. etc. etc.

Be sure to link c0w$(MODEL) before linking your other .obj files.  I
don't remember why but I do remember Borland recommending this.  I hope
this helps.  Marc
----
Two of the worst things we teach our children are that a knowledge of science
is nice but not necessary, and a knowledge of sex is necessary but not nice.

Marc Guyott              Constellation Software, Inc.          (508) 620-2800
                         Framingham, Mass. 01701 USA                Ext. 3135
mguyott@primerd.prime.com       ...!{uunet, decwrl}!primerd.prime.com!mguyott

wytten@cs.umn.edu (Dale Wyttenbach) (04/08/91)

I posted two questions about linking with Borland-C2.0 last week,
and I'd like to thank the many helpful people who responded.  Answers
to both my questions could be found in the Borland-C User's Guide.
One of these days I'm going to have to invent a book index that is
indexed by what you're thinking about instead of being indexed by
keywords you don't know yet :-)

In <1991Apr3.163007.4958@cs.umn.edu> wytten@cs.umn.edu (myself) writes:
>I'm trying to compile a program originally written for MSC under BorlandC.
>There are approximately 50 object files, which I have compiled with
>bcc.  I have two questions that are related.
>(1)
>When I try to link them, I get the error message:
>undefined symbol _main in module c0.asm

User's Guide, pg. 63: Options|Compiler|Code Generation|Generate Underbars
If you are linking with standard libraries, this box must be checked.

Comment: Argh!  What a ridiculous trap to set for an unsuspecting UNIX
programmer.  I used whatever the default options were, which apparently
included the standard libraries but *NOT* having this box checked.

>(2)
>When I try to link from a makefile with tlink,
>it bombs because the command-line arguments are too long.

See User's Guide, pg. 235: Using Response Files.

Thanks again!

dale
-- 
 Dale Wyttenbach     | We all shine on,
 wytten@cs.umn.edu   | like the moon, the stars and the sun.
                     |                                      --John Lennon