Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > linking problem

Reply
Thread Tools

linking problem

 
 
vaib
Guest
Posts: n/a
 
      04-27-2008
hi all ,
i am facing a funny problem in C . i am using turbo's compiler - the
16 bit compiler for dos . i made a file maximum.h which contains a
function declaration , and includes files such as stdio.h . i then
made a maximum.c which contains the definition of the function
declared in maximum.h . maximum.c also includes maximum.h . then i
made a main.c which includes maximum.h and calls the function declared
in maximum.h . all the 3 files compile well but when i run main.c , it
gives me a linker error that it cannot find the function's obj . i've
tried everything . i put all in bin n compiled . i put all under one
folder n compile but nothing seems to work . how do i make the linker
aware of my maximum.obj ??
 
Reply With Quote
 
 
 
 
Antoninus Twink
Guest
Posts: n/a
 
      04-27-2008
On 27 Apr 2008 at 10:48, vaib wrote:
> i am facing a funny problem in C . i am using turbo's compiler - the
> 16 bit compiler for dos .


A popular choice around here! Heathfield's favorite compiler too, if I'm
not mistaken - you can't say that clc doesn't cultivate a certain
eccentricity.

> i made a file maximum.h which contains a function declaration , and
> includes files such as stdio.h . i then made a maximum.c which
> contains the definition of the function declared in maximum.h .
> maximum.c also includes maximum.h . then i made a main.c which
> includes maximum.h and calls the function declared in maximum.h . all
> the 3 files compile well but when i run main.c , it gives me a linker
> error that it cannot find the function's obj . i've tried everything .
> i put all in bin n compiled . i put all under one folder n compile but
> nothing seems to work . how do i make the linker aware of my
> maximum.obj ??


Did you tell the linker than maximum.obj exists? Normally you need to
include it as one of the arguments on the command line - check your
linker's documentation.

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      04-27-2008
vaib wrote:

> hi all ,
> i am facing a funny problem in C . i am using turbo's compiler - the
> 16 bit compiler for dos . i made a file maximum.h which contains a
> function declaration , and includes files such as stdio.h . i then
> made a maximum.c which contains the definition of the function
> declared in maximum.h . maximum.c also includes maximum.h . then i
> made a main.c which includes maximum.h and calls the function declared
> in maximum.h . all the 3 files compile well but when i run main.c , it
> gives me a linker error that it cannot find the function's obj . i've
> tried everything . i put all in bin n compiled . i put all under one
> folder n compile but nothing seems to work . how do i make the linker
> aware of my maximum.obj ??


Include it in the command line during compilation or during linking if
your perform the latter separately. See TC's documentation.

 
Reply With Quote
 
Noob
Guest
Posts: n/a
 
      04-28-2008
Antoninus Twink wrote:

> Someone wrote:
>
>> I am using turbo's compiler - the 16 bit compiler for DOS.

>
> A popular choice around here! Heathfield's favorite compiler too,
> if I'm not mistaken - you can't say that clc doesn't cultivate a
> certain eccentricity.


You, sir, truly have no life.
 
Reply With Quote
 
vaib
Guest
Posts: n/a
 
      05-01-2008
On Apr 27, 4:00 pm, Antoninus Twink <(E-Mail Removed)> wrote:
> On 27 Apr 2008 at 10:48, vaib wrote:
>
> > i am facing afunnyproblemin C . i am using turbo's compiler - the
> > 16 bit compiler for dos .

>
> A popular choice around here! Heathfield's favorite compiler too, if I'm
> not mistaken - you can't say that clc doesn't cultivate a certain
> eccentricity.
>
> > i made a file maximum.h which contains a function declaration , and
> > includes files such as stdio.h . i then made a maximum.c which
> > contains the definition of the function declared in maximum.h .
> > maximum.c also includes maximum.h . then i made a main.c which
> > includes maximum.h and calls the function declared in maximum.h . all
> > the 3 files compile well but when i run main.c , it gives me a linker
> > error that it cannot find the function's obj . i've tried everything .
> > i put all in bin n compiled . i put all under one folder n compile but
> > nothing seems to work . how do i make the linker aware of my
> > maximum.obj ??

>
> Did you tell the linker than maximum.obj exists? Normally you need to
> include it as one of the arguments on the command line - check your
> linker's documentation.


no i didn't tell the linker about it . thats why its not able to find
or link it . where do i get the required documentation from ??
 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      05-01-2008
vaib wrote:

> On Apr 27, 4:00 pm, Antoninus Twink <(E-Mail Removed)> wrote:
>> On 27 Apr 2008 at 10:48, vaib wrote:
>>
>> > i am facing afunnyproblemin C . i am using turbo's compiler - the
>> > 16 bit compiler for dos .

>>
>> A popular choice around here! Heathfield's favorite compiler too, if
>> I'm not mistaken - you can't say that clc doesn't cultivate a certain
>> eccentricity.
>>
>> > i made a file maximum.h which contains a function declaration , and
>> > includes files such as stdio.h . i then made a maximum.c which
>> > contains the definition of the function declared in maximum.h .
>> > maximum.c also includes maximum.h . then i made a main.c which
>> > includes maximum.h and calls the function declared in maximum.h .
>> > all the 3 files compile well but when i run main.c , it gives me a
>> > linker error that it cannot find the function's obj . i've tried
>> > everything . i put all in bin n compiled . i put all under one
>> > folder n compile but nothing seems to work . how do i make the
>> > linker aware of my maximum.obj ??

>>
>> Did you tell the linker than maximum.obj exists? Normally you need to
>> include it as one of the arguments on the command line - check your
>> linker's documentation.

>
> no i didn't tell the linker about it . thats why its not able to find
> or link it . where do i get the required documentation from ??


Turbo C has quite a bit of help included as default. First read the
README file by either invoking the readme.com utility or directly
opening the readme file in a editor like edit. Then invoke the
THELP.COM utility for the main documentation. The help for using
THELP.COM is found in the THELP.DOC file. Finally there is online help
within the Turbo C IDE available by pressing F1 at any time. Also
invoking tcc without any command options will get it to print some
terse usage information onto the screen.

 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      05-01-2008
vaib wrote, On 01/05/08 18:02:
> On Apr 27, 4:00 pm, Antoninus Twink <(E-Mail Removed)> wrote:


<snip>

>> include it as one of the arguments on the command line - check your
>> linker's documentation.

>
> no i didn't tell the linker about it . thats why its not able to find
> or link it . where do i get the required documentation from ??


Probably the same place you get your linker from. For me this varies
between a DVD provided by MS, in man page provided by IBM, an info
document provided as part of a Linux distribution and a few other
places. If you need further direction on your specific tools ask on a
group/mailing-list/web-forum dedicated to your compiler, since there are
literally thousands of different compilers and linkers and they work
differently.
--
Flash Gordon
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking problem in Primetime tinoosh VHDL 1 05-09-2005 08:28 AM
problem linking java virtual machine... enantiomer Java 1 03-12-2005 05:23 AM
linking help file problem .. =?Utf-8?B?Y2hyaXM=?= ASP .Net 0 10-25-2004 01:07 PM
Linking problem Joerg M. Colberg ASP .Net 2 07-07-2004 08:46 PM
Linking Module Problem? Hristo Stevic Java 2 03-06-2004 11:00 PM



Advertisments