linking problem

Discussion in 'C Programming' started by vaib, Apr 27, 2008.

  1. vaib

    vaib Guest

    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 ??
    vaib, Apr 27, 2008
    #1
    1. Advertising

  2. 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.
    Antoninus Twink, Apr 27, 2008
    #2
    1. Advertising

  3. vaib

    santosh Guest

    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.
    santosh, Apr 27, 2008
    #3
  4. vaib

    Noob Guest

    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.
    Noob, Apr 28, 2008
    #4
  5. vaib

    vaib Guest

    On Apr 27, 4:00 pm, Antoninus Twink <> 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 ??
    vaib, May 1, 2008
    #5
  6. vaib

    santosh Guest

    vaib wrote:

    > On Apr 27, 4:00 pm, Antoninus Twink <> 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.
    santosh, May 1, 2008
    #6
  7. vaib

    Flash Gordon Guest

    vaib wrote, On 01/05/08 18:02:
    > On Apr 27, 4:00 pm, Antoninus Twink <> 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
    Flash Gordon, May 1, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tinoosh

    Linking problem in Primetime

    tinoosh, May 6, 2005, in forum: VHDL
    Replies:
    1
    Views:
    615
    topgun
    May 9, 2005
  2. Joerg M. Colberg

    Linking problem

    Joerg M. Colberg, Jul 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    419
    Joerg M. Colberg
    Jul 7, 2004
  3. =?Utf-8?B?Y2hyaXM=?=

    linking help file problem ..

    =?Utf-8?B?Y2hyaXM=?=, Oct 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    378
    =?Utf-8?B?Y2hyaXM=?=
    Oct 25, 2004
  4. Hristo Stevic

    Linking Module Problem?

    Hristo Stevic, Mar 6, 2004, in forum: Java
    Replies:
    2
    Views:
    307
    John W. Kennedy
    Mar 6, 2004
  5. enantiomer
    Replies:
    1
    Views:
    2,000
    Owen Jacobson
    Mar 12, 2005
Loading...

Share This Page