Date: Tue, 14 Aug 2001 12:18:54 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: "Luis Filipe Fabiani" Message-Id: <1858-Tue14Aug2001121854+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <005601c12455$477bcb80$0200a8c0@lff> (luis2@becrev.com) Subject: Re: Problems with compilation References: <200108140003 DOT UAA12330 AT delorie DOT com> <005601c12455$477bcb80$0200a8c0 AT lff> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Luis Filipe Fabiani" > Date: Mon, 13 Aug 2001 21:08:40 -0300 > > When I try to compile my C program on Red Hat 7 (with gcc -lm), I execute my > program and it works fine. > When I try to compile my program with DJGPP on windows ME, the source > compiles, but the program produces a result that is VERY different... > > This program executes a lot of calculations (its a CFD (Computation Fluid > Dinamics)) It's hard to tell, without more information about what the program does (or, more accurately, HOW does it do that). Here are a few ideas to try: - Try linking the program without -lm. It might fail (if it uses math functions that are only available in libm.a); if so, try putting "-lc -lm" (in that order!) at the end of the link command line. This will cause the program to use a different version of some of the math function; perhaps that will help. - Use the matherr facility to see whether your program calls some math functions with invalid arguments. (For details about this, type "info libc alpha matherr" from the shell prompt, and read there.) As Martin suggested, checking the GCC versions and compilation switches is also a good idea. If none of the above helps, the only way to debug this is to run the program under a debugger, put a breakpoint on the spot where the difference starts to show, and poke around to see what's going on.