Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 1995 19:52:00 -0400 (EDT)
From:      Chuck Robey <chuckr@Glue.umd.edu>
To:        amnuay muthitacharoen <amnuay@comnet.spu.ac.th>
Cc:        questions@FreeBSD.org
Subject:   Re: Gnu C++ Compilation Problem
Message-ID:  <Pine.SUN.3.91.950721194945.15366B-100000@cappuccino.eng.umd.edu>
In-Reply-To: <Pine.AUX.3.91.950721114141.8678A-100000@comnet.spu.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <iostream.h>
> #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!
----------------------------+-----------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.91.950721194945.15366B-100000>