From owner-freebsd-questions Fri Jul 21 16:53:30 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id QAA00555 for questions-outgoing; Fri, 21 Jul 1995 16:53:30 -0700 Received: from who.cdrom.com (who.cdrom.com [192.216.222.3]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id QAA00549 for ; Fri, 21 Jul 1995 16:53:29 -0700 Received: from jolt.eng.umd.edu (jolt.eng.umd.edu [129.2.102.5]) by who.cdrom.com (8.6.11/8.6.11) with ESMTP id QAA17990 for ; Fri, 21 Jul 1995 16:53:15 -0700 Received: from cappuccino.eng.umd.edu (cappuccino.eng.umd.edu [129.2.98.14]) by jolt.eng.umd.edu (8.6.10/8.6.4) with ESMTP id TAA22373; Fri, 21 Jul 1995 19:52:03 -0400 Received: (chuckr@localhost) by cappuccino.eng.umd.edu (8.6.10/8.6.4) id TAA15705; Fri, 21 Jul 1995 19:52:00 -0400 Date: Fri, 21 Jul 1995 19:52:00 -0400 (EDT) From: Chuck Robey To: amnuay muthitacharoen cc: questions@FreeBSD.org Subject: Re: Gnu C++ Compilation Problem In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: questions-owner@FreeBSD.org Precedence: bulk On Fri, 21 Jul 1995, amnuay muthitacharoen wrote: > > When I compiled the following Gnu C++ program in FreeBSD Unix > installed from the FreeBSD CDROM :- > > #include > #include "/usr/include/math.h" > void > main() > { > int num ; > > cout << "Enter num : " ; > cin >> num ; > cout <<"The cube of " << num << " is " << pow(num,3) <<" .\n" ; > } > > > I got the following messages :- > > 1) /var/tmp/cc0100421.0: Undefined symbol '_pow' referenced from text segment > > 2) /usr/lib/libg++.so.2.0: Undefined symbol "_pow" referenced You called pow with at least one int, the 3 might be an int too. Pow is supposed to be double pow( double, double), so you confused the system. Change your types, I bet it will work if you give it the right ones. Remember that under C++, the types are combined with the function name to define which function you *really* call. ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@eng.umd.edu | communications topic, C programming, and Unix. 9120 Edmonston Ct #302 | Greenbelt, MD 20770 | I run Journey2 (Freebsd 2.0) and n3lxx (301) 220-2114 | (FreeBSD 1.1.5.1) and am I happy! ----------------------------+-----------------------------------------------