Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 1995 10:44:20 +0200 (MET DST)
From:      Christoph Kukulies <kuku@gilberto.physik.rwth-aachen.de>
To:        amnuay@comnet.spu.ac.th (amnuay muthitacharoen)
Cc:        freebsd-questions@freefall.cdrom.com (user alias)
Subject:   Re: Gnu C++ Compilation Problem
Message-ID:  <199507210844.KAA26537@gilberto.physik.rwth-aachen.de>
In-Reply-To: <Pine.AUX.3.91.950721114141.8678A-100000@comnet.spu.ac.th> from "amnuay muthitacharoen" at Jul 21, 95 11:42:44 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 
> 	When I compiled the following Gnu C++ program in FreeBSD Unix
> installed from the FreeBSD CDROM :-

How did you compile? I'm sure you forgot to specify -lm
in the link command line.

g++ -o file file.cc -lm


> 
> #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
> 
> 
> 	Please tell me what I had done wrong or did I missed out something ?
> 
> 
> 	Regards
> 
> 	Amnuay Muthitacharoen
> 
> 

--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de
FreeBSD blues.physik.rwth-aachen.de 2.2-CURRENT FreeBSD 2.2-CURRENT #0:
Tue Jul 18 14:49:19 MET DST 1995     kuku@blues.physik.rwth-aachen.de:
/usr/src/sys/compile/BLUESGUS  i386



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507210844.KAA26537>