linking problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vaib

    linking problem

    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 ??
  • Antoninus Twink

    #2
    Re: linking problem

    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.

    Comment

    • santosh

      #3
      Re: linking problem

      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.

      Comment

      • Noob

        #4
        Re: linking problem

        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.

        Comment

        • vaib

          #5
          Re: linking problem

          On Apr 27, 4:00 pm, Antoninus Twink <nos...@nospam. invalidwrote:
          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 ??

          Comment

          • santosh

            #6
            Re: linking problem

            vaib wrote:
            On Apr 27, 4:00 pm, Antoninus Twink <nos...@nospam. invalidwrote:
            >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.

            Comment

            • Flash Gordon

              #7
              Re: linking problem

              vaib wrote, On 01/05/08 18:02:
              On Apr 27, 4:00 pm, Antoninus Twink <nos...@nospam. invalidwrote:
              <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

              Comment

              Working...