From owner-freebsd-questions@FreeBSD.ORG Mon Dec 26 13:49:58 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99C9A16A41F for ; Mon, 26 Dec 2005 13:49:58 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1156B43D4C for ; Mon, 26 Dec 2005 13:49:56 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from alpha.home (ppp144-75.lns3.adl2.internode.on.net [59.167.144.75]) by smtp1.adl2.internode.on.net (8.12.9/8.12.6) with ESMTP id jBQDnsoG088169; Tue, 27 Dec 2005 00:19:55 +1030 (CST) (envelope-from malcolm.kay@internode.on.net) From: Malcolm Kay Organization: at home To: freebsd-questions@freebsd.org Date: Tue, 27 Dec 2005 00:19:49 +1030 User-Agent: KMail/1.8 References: <20051226031638.64935.qmail@web35701.mail.mud.yahoo.com> In-Reply-To: <20051226031638.64935.qmail@web35701.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512270019.49456.malcolm.kay@internode.on.net> Cc: TV JOE Subject: Re: Compiling linux applications X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2005 13:49:58 -0000 On Mon, 26 Dec 2005 01:46 pm, TV JOE wrote: > Hi, > > I've a C program written for Suse linux. I'm having minor > problems compiling. First is that the cexp (complex exponent) > is not available in /usr/include/math.h. Is it possible to add > on a library that includes this function? I compile as 'gcc > -lm program.c'. > Mathematically the complex exponent is exp(real_part)*(cos(imag_part)+i*sin(imag_part) and by the standard has the prototype: #include double complex cexp(double complex z); So you can easily define it for yourself: #include #include double complex cexp(double complex z){ return exp(creal(z))*(cos(cimag(z)) + sin(cimag(z))*I); } Or even perhaps as a macro: #include #include #define cexp(z) (exp(creal(z))*(cos(cimag(z)) + sin(cimag(z))*I)) > Additionally there is a timer program that creates this > compile error > > GC.c: In function `gettime': > GC.c:252: error: storage size of 'ltim' isn't known > > Here is gettime > > /************************************************************* >*******/ // Functions start here. > /************************************************************* >*******/ > > // Function to read system time. Only used for testing > execution speed. long int gettime(void) > { > struct timeval ltim; This is easy; you don't have the definition of the struct timeval in scope. It is defined in So add #include near the beginning of the source file. Malcolm > > gettimeofday(<im, NULL); > return (((long int)ltim.tv_sec)*((long > int)(1000000))+((long int)ltim.tv_usec)); } > > > I'm compiling on a 5.3 box. Thanks for any help, >