floating format not linked

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

    #1

    floating format not linked

    struct symbol
    {
    char ch;
    float probability;
    char *codeword;
    };

    void get_user_input( struct symbol **sptr)
    {
    .....
    scanf("%c%f",&( (*sptr)[i].ch),&((*sptr)[i].probability));
    .....
    }

    Turbo C++ compiler (3.0) gave me
    "floating point formats not linked. Abnormal program termination"
    error.

    If I scanned them into temp. vars and then assigned indivisually it
    works just fine....

    May I know what's problem here, compiler bug.....?

  • Alexei A. Frounze

    #2
    Re: floating format not linked

    "Rajesh" <rajeshsbhide21 11@yahoo.co.in> wrote in message
    news:1126512534 .901601.160680@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > struct symbol
    > {
    > char ch;
    > float probability;
    > char *codeword;
    > };
    >
    > void get_user_input( struct symbol **sptr)
    > {
    > ....
    > scanf("%c%f",&( (*sptr)[i].ch),&((*sptr)[i].probability));
    > ....
    > }
    >
    > Turbo C++ compiler (3.0) gave me
    > "floating point formats not linked. Abnormal program termination"
    > error.
    >
    > If I scanned them into temp. vars and then assigned indivisually it
    > works just fine....
    >
    > May I know what's problem here, compiler bug.....?[/color]

    It's your bug. You didn't link the math library in. It comes in different
    library than the rest of the standard functions. If you're using the IDE,
    find in the options the checkbox that enables linking of the math library.
    If you're compiling and linking from command line, give the linker the
    appropriate library file name (math?.lib). If you're compiling manually
    through command line, make sure you choose libraries for the same memory
    model, which is used for compilation (tiny, small, meduim, large, huge).

    HTH,
    Alex


    Comment

    • Irrwahn Grausewitz

      #3
      Re: floating format not linked

      "Rajesh" <rajeshsbhide21 11@yahoo.co.in> wrote:[color=blue]
      >struct symbol
      >{
      > char ch;
      > float probability;
      > char *codeword;
      >};
      >
      >void get_user_input( struct symbol **sptr)
      >{
      >....
      >scanf("%c%f",& ((*sptr)[i].ch),&((*sptr)[i].probability));
      >....
      >}
      >
      >Turbo C++ compiler (3.0) gave me
      >"floating point formats not linked. Abnormal program termination"
      >error.
      >
      >If I scanned them into temp. vars and then assigned indivisually it
      >works just fine....
      >
      >May I know what's problem here, compiler bug.....?[/color]

      That's not a question about C, but about a specific implementation.

      Searching Google for Borland "floating point formats not linked"
      will give you the desired information.

      Best regards
      --
      Irrwahn Grausewitz (irrwahn35@free net.de)
      welcome to clc : http://www.ungerhu.com/jxh/clc.welcome.txt
      clc faq-list : http://www.faqs.org/faqs/C-faq/faq/
      clc frequent answers: http://benpfaff.org/writings/clc

      Comment

      • Flash Gordon

        #4
        Re: floating format not linked

        Rajesh wrote:[color=blue]
        > struct symbol
        > {
        > char ch;
        > float probability;
        > char *codeword;
        > };
        >
        > void get_user_input( struct symbol **sptr)
        > {
        > ....
        > scanf("%c%f",&( (*sptr)[i].ch),&((*sptr)[i].probability));
        > ....
        > }
        >
        > Turbo C++ compiler (3.0) gave me
        > "floating point formats not linked. Abnormal program termination"
        > error.
        >
        > If I scanned them into temp. vars and then assigned indivisually it
        > works just fine....
        >
        > May I know what's problem here, compiler bug.....?[/color]

        It's a FAQ http://www.eskimo.com/~scs/C-faq/q14.3.html
        Not exactly your question, but the same problem. You will have to either
        read the manuals for you compiler or ask where your compiler is on topic
        to find out how to get the maths libraries linked in.

        Please check the FAQ for answers to other questions before posting them
        here, that is what FAQs are for!
        --
        Flash Gordon
        Living in interesting times.
        Although my email address says spam, it is real and I read it.

        Comment

        • Martin Ambuhl

          #5
          Re: floating format not linked

          Rajesh wrote:
          [...][color=blue]
          > Turbo C++ compiler (3.0) gave me
          > "floating point formats not linked. Abnormal program termination"
          > error.[/color]

          Please check the FAQ before posting.

          <http://www.eskimo.com/~scs/C-faq/q14.13.html>
          Question 14.13

          I'm having trouble with a Turbo C program which crashes and says
          something like ``floating point formats not linked.''

          Some compilers for small machines, including Borland's (and Ritchie's
          original PDP-11 compiler), leave out certain floating point support if
          it looks like it will not be needed. In particular, the
          non-floating-point versions of printf and scanf save space by not
          including code to handle %e, %f, and %g. It happens that Borland's
          heuristics for determining whether the program uses floating point are
          insufficient, and the programmer must sometimes insert an extra,
          explicit call to a floating-point library routine to force loading of
          floating-point support. (See the comp.os.msdos.p rogrammer FAQ list for
          more information.)

          Read sequentially: prev next up top

          This page by Steve Summit // Copyright 1995 // mail feedback

          Comment

          Working...