Article View: gnu.gcc.help
Article #45(none)
From: Bill Wied
Date: Wed, 04 Nov 1992 20:53
Date: Wed, 04 Nov 1992 20:53
64 lines
1623 bytes
1623 bytes
Hello,
I am using GCC 2.2.2 to compile some test C++ code and I get a loading
error from ld.
Here is the code I am trying to compile:
#include <stdio.h>
class Cube
{
private:
int length, width, height;
public:
Cube(int,int,int);
~Cube(void);
volume();
};
Cube::Cube(int l, int w, int h)
{
length=l;
width=w;
height=h;
}
int Cube::volume()
{
return(length*width*height);
}
main()
{
Cube testcube(2,3,4);
printf("The volume of this cube is :%d\n",testcube.volume());
}
And I get the following result when I try and compile it:
% gcc a.C
a.C: In function `int main ()':
a.C:31: warning: implicit declaration of function `printf'
ld: Undefined symbol
__$_4Cube
collect: /usr/bin/ld returned 2 exit status
%
Do you have any idea why it is not compiling correctly I don't seem to have
any problem compiling regular C code. I would appreciate any help you could
give me.
Thanks,
Bill Wied
wied@animal.sps.mot.com
602-897-4266
Network Applications Group
Semiconductor Products Sector
Motorola Inc.
p.s. If you would like you could send me an email message and I could call
you back regarding this problem. Thanks again.
Technical Details
Message-ID:
<9211042053.AA22710@animal.sps.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!animal.sps.mot.COM!wiedShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!animal.sps.mot.COM!wied From: wied@animal.sps.mot.COM (Bill Wied) Subject: (none) Message-ID: <9211042053.AA22710@animal.sps.mot.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 4 Nov 1992 20:53:38 GMT Lines: 66