PRODUCT : Borland C++ NUMBER : 645 VERSION : ALL OS : DOS DATE : October 22, 1993 PAGE : 1/4 TITLE : "Floating point formats not linked" messages. This document explains why you might be getting the error FLOATING POINT FORMATS NOT LINKED : ABNORMAL PROGRAM TERMINATION and tells you how to resolve it. The problems and solutions below apply to ALL versions of Turbo C, Turbo C++, and Borland C++, except where noted. What are floating point formats? Floating point formats are a collection of formatting information used to manipulate floating point numbers in certain runtime library functions such as scanf() and atof(). When will this be fixed? There are no current plans to fix this because it is not a bug. The intent is to avoid linking the floating point formats (about 1K of overhead) when they are not required. The tradeoff of this feature is that the programmer must explicitly request that the floating point formats to be linked in for some programs which manipulate floats in a limited and specific fashion. How do I resolve the error message? Since you can get the error in a number of different ways, check the following list of potential causes to find out how to resolve the error. These are listed in order of most common to least common causes. 1. CAUSE: Floating point set to . Your have your floating point option set to None when it should be set to either Emulation or 80x87. FIX: Set Floating Point to or <80x87>. In the Integrated Development Environment (IDE), this is either under Options | Compiler | Advanced Code Generation or Options | Compiler | Code Generation | More, depending upon which compiler you have. With the command line compiler, use the appropriate -f switch. 2. CAUSE: Misordered libraries when executing TLINK (Cx.LIB listed before EMU.LIB will cause the error.) PRODUCT : Borland C++ NUMBER : 645 VERSION : ALL OS : DOS DATE : October 22, 1993 PAGE : 2/4 TITLE : "Floating point formats not linked" messages. FIX: This possibility usually occurs only when you are using the command line compiler and are explicitly calling TLINK separately from BCC or TCC. When executing TLINK, change the order of the libraries to [user libs] [GRAPHICS.LIB] EMU.LIB MATHx.LIB Cx.LIB (libraries in brackets are optional) Note: There is a misprint in the Borland C++ Tools & Utilities Guide on page 58 that displays the wrong order for libraries on the TLINK command line. The ordering shown in the manual is exactly what will cause floating point formats not linked. 3. CAUSE: Either the compiler is overoptimizing, or the floating point formats really do need to be linked in because your program manipulates floats in a limited and specific fashion. Under certain obscure conditions, the compiler will ignore floating point usage in scanf(). (e.g., trying to read into a float variable that is part of an array contained in a structure.) FIX: If you have Borland C++ 3.0 or later, read Part A. If you have Borland C++ 2.0 or any Turbo C or Turbo C++ compiler, read Part B. This fix is the only fix that will solve a "PRINTF : Floating point formats not linked" error message occurring with inline assembly. Part A (BC++ 3.0 or later): Add the following to one source module: extern _floatconvert; #pragma extref _floatconvert The README and HELPME!.DOC files that shipped with Borland C++ 3.0 incorrectly say that only #pragma extref _floatconvert is required in order to resolve the FPFNL error. If you do not include the "extern _floatconvert;" line you will get the error "Undefined symbol _floatconvert." You will also get the same undefined symbol if the "extern PRODUCT : Borland C++ NUMBER : 645 VERSION : ALL OS : DOS DATE : October 22, 1993 PAGE : 3/4 TITLE : "Floating point formats not linked" messages. _floatconvert" comes after the #pragma line instead of before. Note that the #pragma line does not have a semicolon at the end of the line. If you put a semicolon there, you will get the error "Bad pragma directive syntax." The README that shipped with Borland C++ 3.1 says that extern void _floatconvert(); #pragma extref _floatconvert This should work, as well. It doesn't really matter whether _floatconvert is a variable or a function; it only matters that it is some symbol that the linker will recognize. The HELPME!.DOC for BC++ 3.1 has the correct two lines to add. Part B (BC++ 2.0 or TC or TC++): Add the following force_fpf() function to one source module. It is not necessary to call this function; just include it in one of your modules. static void force_fpf() { float x, *y; /* Just declares two variables */ y = &x; /* Forces linkage of FP formats */ x = *y; /* Suppress warning message about x */ } 4. CAUSE: Forgetting to put the address operator & on the scanf variable expression. For example, float foo; scanf("%f", foo); FIX: Change the code so that the & operator is used where it is needed. For example, the above code should be float foo; scanf("%f", &foo); PRODUCT : Borland C++ NUMBER : 645 VERSION : ALL OS : DOS DATE : October 22, 1993 PAGE : 4/4 TITLE : "Floating point formats not linked" messages. 5. CAUSE: A bug in Turbo C 2.0 when using scanf() FIX: Obtain and apply the patches in TC2PAT.ARC. This file can be downloaded from the Languages / C++ / Patches section on DLBBS (408-439-9096). 6. CAUSE: A bug in Turbo C 2.01 when using atof() or strtod() FIX: Obtain and apply the patches in TC21PT.ARC. This file can be downloaded from the Languages / C++ / Patches section on DLBBS (408-439-9096). 7. CAUSE: You are trying to create a Phar Lap DOS Extender application with the Integrated Development Environment (IDE). FIX: Phar Lap includes an executable called BCC286.EXE with their DOS Extender. This program calls Borland's command- line compiler (BCC) and command-line linker (TLINK). Since the linker in the IDE is different than the linker at the command line, you cannot create Phar Lap DOS Extender applications in the IDE and expect them to run properly. If you try to do so, you might get a floating point formats not linked error message. The fix is to use the command line tools, BCC and TLINK, instead of the IDE. Keywords: FPFNL , APT DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.