Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!hp-pcd!hpcvia!brianh From: brianh@hpcvia.CV.HP.COM (brian_helterline) Newsgroups: comp.lang.c Subject: Re: Problem with Turbo C++ Message-ID: <31530021@hpcvia.CV.HP.COM> Date: 3 Oct 90 15:22:37 GMT References: Organization: Hewlett-Packard Co., Corvallis, Oregon Lines: 48 >I hope someone can help me with this one! > After much procrastinating I decided to attempt to learn C after many >years as a strictly FORTRAN programmer. I got started O.K. writing the >standard "Hello World" program and then some very simple file I/O code. >Now the trouble starts! What I want to do is read in a vector, actually >the variable I use is a matrix but I only want to read one column from the >file which has a format like: >2 >1.00 >2.00 >where two is the number of elements in the file. To accomplish this I >used this piece of code: >for( nr=1; nr <= Anr; nr++) >{ > fscanf( inpfile, "%f\n", &A[nr][1] ); >} >Now everything compiles fine but when I run it I get the following error: > scanf : floating point formats not linked >Abnormal program terminaion. >Anyone know what this means? I can run the code fine using VAXC or "cc" >on Unix but Turbo C++ always gives me the above errror on my PC. Ahh yes, the old missing floating point library - pitty they don't fix this. The problem is that TC does not "see" any statements in your code which require floating point math so it "helps" you out by not including it even though scanf() needs it! One of the standard work arounds for this is to place a single line in you code at the beginning like this: exp(1.0) /* code to insure floating point inclusion */ then TC will "see" a statement that requires floating point math [exp()] and include the floating point library for you. Hope this helps..................... -Brian