From owner-freebsd-questions@FreeBSD.ORG Tue Apr 11 22:54:20 2006 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 2EF3716A400 for ; Tue, 11 Apr 2006 22:54:20 +0000 (UTC) (envelope-from herriojr@gmail.com) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.191]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9413E43D5C for ; Tue, 11 Apr 2006 22:54:19 +0000 (GMT) (envelope-from herriojr@gmail.com) Received: by nproxy.gmail.com with SMTP id m18so978380nfc for ; Tue, 11 Apr 2006 15:54:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=H8gh0qPTR3fpaYL4MqAspB0IeJsOfceddKDvfB+jtNcEk9n+10I4gzCniBeQjACTNnCke/kC9a4waCdYuRuyeQQP0zSiTMbth9T2ENEY9XFaXeHlsT+ICrB4zmHPW2Be91oGuduX9Duf93nMhKh9mwRjcDlIArgd2TG2S/kUYGg= Received: by 10.48.14.20 with SMTP id 20mr559216nfn; Tue, 11 Apr 2006 15:54:18 -0700 (PDT) Received: by 10.49.29.3 with HTTP; Tue, 11 Apr 2006 15:54:18 -0700 (PDT) Message-ID: <6a56d69c0604111554o587ce2c5ha1ff4ea20bbab0a4@mail.gmail.com> Date: Tue, 11 Apr 2006 22:54:18 +0000 From: "Jonathan Herriott" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: pow function working unexpectedly 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: Tue, 11 Apr 2006 22:54:20 -0000 I just want to make sure I'm not being stupid before I send in a bug.=20 The problem seems to be with gcc when using the pow function in the math.h library. Here's code that works: #include #include int main() { printf("%f\n", pow(2,3)); return 0; } Now, the following will not compile: #include #include int main() { int x =3D 2; // I tried these as doubles too since the pow function takes doubles int y =3D 3; printf("%f\n", pow(x,y)); return 0; } I compiled both programs using: gcc test.c The second example gives the following error: /var/tmp//ccxtkMwv.o(.text+0x45): In function `main': : undefined reference to `pow' If I comile with g++, I have no issues. Are these results that I should have? If so, why? If not, I'm going to submit the bug on gcc (or the linker, but I'm guessing it's the same group). Thanks, Jonathan Herriott