floating format not linked

R

Rajesh

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

void get_user_input(struct symbol **sptr)
{
.....
scanf("%c%f",&((*sptr).ch),&((*sptr).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.....?
 
A

Alexei A. Frounze

Rajesh said:
struct symbol
{
char ch;
float probability;
char *codeword;
};

void get_user_input(struct symbol **sptr)
{
....
scanf("%c%f",&((*sptr).ch),&((*sptr).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.....?


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
 
I

Irrwahn Grausewitz

Rajesh said:
struct symbol
{
char ch;
float probability;
char *codeword;
};

void get_user_input(struct symbol **sptr)
{
....
scanf("%c%f",&((*sptr).ch),&((*sptr).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.....?


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
 
F

Flash Gordon

Rajesh said:
struct symbol
{
char ch;
float probability;
char *codeword;
};

void get_user_input(struct symbol **sptr)
{
....
scanf("%c%f",&((*sptr).ch),&((*sptr).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.....?


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!
 
M

Martin Ambuhl

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

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.programmer FAQ list for
more information.)

Read sequentially: prev next up top

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top