Thread: Borland Turbo C 2.01 Floating Point Error

  1. #1

    Question Borland Turbo C 2.01 Floating Point Error

    Sorry if this message is in the wrong place, but I could not find a
    Turbo C group.

    The following program compiles with Borland Turbo C 2.01, but does not
    run properly:

    #include <stdio.h>
    #include <stdlib.h>

    void main()
    char cnum[] = "123.4";
    float fnum;

    fnum = atof(cnum);
    printf("%f\n", fnum);

    The error I get is:

    " scanf : floating point formats not linked
    Abnormal program termination"

    Has anyone experienced these problems before, if so can I change some
    settings within the compiler. Or does it mean using another compiler.
    I have downloaded the Borland BCC55 FreeCommandLineTools, but I am
    struggling to get it to compile my C programs (all the
    instructions/help seem to be for CPP programs).

    I have tried on two machines a) Pentium II 233MhZ (Laptop) and b)
    Intel Celeron 800 MHz (Desktop).

    Any help please.


  2. #2
    Registered User
    Join Date
    Sep 2001
    You need to set the linker options to include floating-point support.

    Remember, math coprocessors didn't appear until the 386, I believe, and the Pentium was the first to have math coprocessors (for hardware support of floating-point math) in all machines.

    So, very old compilers didn't link floating point libraries by default -- if you need to use a float in an old compiler (or even in newer compilers that can produce true DOS programs), you must tell it you want floating point support.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM