Hello,
After installing update.0828 (the install script is broken, because it
assumes the existence of the .../ia64-sgi-linux/sgicc-1.0/include
directory, which doesn't actually exist) I can compile and link a
small C++ test program (on a native ia64 Linux system) with no
optimisation options, but if I try -O I get a linking problem:
pc64-016:~ 0 8> uname -a
Linux pc64-016 2.4.0-0.8smp #1 SMP Sun Jun 18 00:32:35 EDT 2000 ia64 unknown
pc64-016:~ 0 9> sgiCC -v
SGIcc Compilers: Version 0.01.0-10
pc64-016:~ 0 10> sgiCC cpptest.cpp
pc64-016:~ 0 11> ./a.out
Total momentum: (4.30413,6.42872,77.3842) 77.77
10000
pc64-016:~ 0 12> sgiCC -O cpptest.cpp
cpptest.o:/usr/lib/gcc-lib/ia64-redhat-linux/2.9-ia64-000216-final/../../../../include/g++-3/stl_vector.h:591:
undefined reference to `__dcis'
collect2: ld returned 1 exit status
I couldn't figure out where __dcis was supposed to come from, because it
doesn't seem to be defined anywhere in the compiler or system libraries.
I append the source code of the test program.
Thank you,
Dan Pop
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
class momentum {
public:
momentum() {
double cosTheta = 1.0 - 2.0*Rand();
double sinTheta = sqrt(1-cosTheta*cosTheta);
double Phi = 2.0*M_PI*Rand();
x = cos(Phi)*sinTheta;
y = cos(Phi)*cosTheta;
z = sin(Phi);
}
momentum(const double aX, const double aY, const double aZ) :
x(aX),y(aY),z(aZ) {}
momentum(const momentum & M) :
x(M.GetX()),y(M.GetY()),z(M.GetZ()) {}
momentum operator - (void) {return momentum(-x,-y,-z);}
momentum & operator *= (const double c) {
x *= c;
y *= c;
z *= c;
return *this;
}
momentum & operator += (const momentum & a) {
x += a.GetX();
y += a.GetY();
z += a.GetZ();
return *this;
}
void SetX(const double aX) {x = aX;}
void SetY(const double aY) {y = aY;}
void SetZ(const double aZ) {z = aZ;}
double GetX(void) const {return x;}
double GetY(void) const {return y;}
double GetZ(void) const {return z;}
double Magnitude(void) const {return sqrt(x*x+y*y+z*z);}
private:
double Rand(void) { return double(rand())/double(RAND_MAX);}
private:
double x;
double y;
double z;
};
inline momentum operator + (const momentum & a, const momentum & b) {
return momentum(a.GetX()+b.GetX(),a.GetY()+b.GetY(),a.GetZ()+b.GetZ());
}
inline std::ostream & operator << (std::ostream & out, const momentum & m) {
return out << "(" << m.GetX() << "," << m.GetY() << "," << m.GetZ() <<
")";
}
int main(void) {
// Use a vector with N elements
const int N = 10000;
vector<momentum> aVector;
aVector.reserve(N);
for (int i = 0; i < N; ++i) aVector.push_back( momentum() );
double totalMag = 0.0;
momentum totalMom(0.0,0.0,0.0);
for (unsigned int i = 0; i < aVector.size(); i++) {
totalMom += aVector[i];
}
for (unsigned int i = 0; i < aVector.size(); i++) {
totalMag += aVector[i].Magnitude();
}
vector<momentum>::iterator j;
// cout << "Momenta: " << endl;
// for (j = aVector.begin(); j != aVector.end(); ++j) cout << "
" << *j << endl;
cout << "Total momentum: " << totalMom << " " << totalMom.Magnitude()
<< endl;
cout << totalMag << endl;
return 0;
}
|