C
Clifton M. Bean
First, I defined three classes (listed below):
===========
// 1st class
===========
class PointCl
{
public:
PointCl & operator= (const PointCl & rgh ); //define as usual
assingment operator
private:
double _x;
}
===========
// 2nd class
===========
class Ball :: public PointCl
{
public:
Ball & operator= (const Ball & );
private:
double _r;
}
Ball & Ball:perator( const Ball & rgh )
{
if( this != & rgh )
{
PointCl:perator= rgh;
// static_cast<PointCl & > (*this) = rgh; I tried to this as well
_r = rgh._r;
}
}
===============
3rd class
===============
class ChainCl
{
private:
............
public:
std::vector<Ball> _vBall;
PointCl _cntrCrav;
}
===========
Interestingly, this code runs okay in Visual Studio; however, I get the
following error when I try to link the same files on a Solaris machine:
rm -f driver PointCl.o Distance.o Ball.o ChainCl.o driver.o
make[1]: Entering directory `/home/cs/k/kathym/Bioinformatics/myPart'
g++ -Wall -c -gstabs driver.cxx
g++ -Wall -c -gstabs ChainCl.cxx
g++ -Wall -c -gstabs Ball.cxx
g++ -Wall -c -gstabs PointCl.cxx
g++ -Wall -c -gstabs Distance.cxx
g++ -Wall -gstabs driver.o ChainCl.o -lm -o driver
Undefined first referenced
symbol in file
Ball:perator=(Ball const&) ChainCl.o
operator<<(std::basic_ostream<char, std::char_traits<char> >&, PointCl
const&)dr
iver.o
ld: fatal: Symbol referencing errors. No output written to driver
collect2: ld returned 1 exit status
make[1]: *** [driver] Error 1
make[1]: `PointCl.o' is up to date.
make[1]: `Distance.o' is up to date.
make[1]: `Ball.o' is up to date.
make[1]: `ChainCl.o' is up to date.
make[1]: `driver.o' is up to date.
make[1]: Leaving directory `/home/cs/k/kathym/Bioinformatics/myPart'
make: *** [all] Error 2
Please help me figure this out or determine a way to determine why all is
okay within Visual Studio and not within a Solaris UNIX environment.
Thank you in advance.
Kathryn Bean
===========
// 1st class
===========
class PointCl
{
public:
PointCl & operator= (const PointCl & rgh ); //define as usual
assingment operator
private:
double _x;
}
===========
// 2nd class
===========
class Ball :: public PointCl
{
public:
Ball & operator= (const Ball & );
private:
double _r;
}
Ball & Ball:perator( const Ball & rgh )
{
if( this != & rgh )
{
PointCl:perator= rgh;
// static_cast<PointCl & > (*this) = rgh; I tried to this as well
_r = rgh._r;
}
}
===============
3rd class
===============
class ChainCl
{
private:
............
public:
std::vector<Ball> _vBall;
PointCl _cntrCrav;
}
===========
Interestingly, this code runs okay in Visual Studio; however, I get the
following error when I try to link the same files on a Solaris machine:
rm -f driver PointCl.o Distance.o Ball.o ChainCl.o driver.o
make[1]: Entering directory `/home/cs/k/kathym/Bioinformatics/myPart'
g++ -Wall -c -gstabs driver.cxx
g++ -Wall -c -gstabs ChainCl.cxx
g++ -Wall -c -gstabs Ball.cxx
g++ -Wall -c -gstabs PointCl.cxx
g++ -Wall -c -gstabs Distance.cxx
g++ -Wall -gstabs driver.o ChainCl.o -lm -o driver
Undefined first referenced
symbol in file
Ball:perator=(Ball const&) ChainCl.o
operator<<(std::basic_ostream<char, std::char_traits<char> >&, PointCl
const&)dr
iver.o
ld: fatal: Symbol referencing errors. No output written to driver
collect2: ld returned 1 exit status
make[1]: *** [driver] Error 1
make[1]: `PointCl.o' is up to date.
make[1]: `Distance.o' is up to date.
make[1]: `Ball.o' is up to date.
make[1]: `ChainCl.o' is up to date.
make[1]: `driver.o' is up to date.
make[1]: Leaving directory `/home/cs/k/kathym/Bioinformatics/myPart'
make: *** [all] Error 2
Please help me figure this out or determine a way to determine why all is
okay within Visual Studio and not within a Solaris UNIX environment.
Thank you in advance.
Kathryn Bean