Topic: STL vector of Matrix class
Author: robertd@deletethis.netlink.co.nz (Robert Davies)
Date: 1998/09/30 Raw View
wada@ee.ibaraki.ac.jp (Wada Tatsuaki) wrote:
>
>Could someone explain the differeces when compiling the same code with same
>compiler but on different OS?
>
>I'd like to build a STL vector of the SymmetricMatrix class of the free
>newmat09 library. (http://nz.com/webnz/robert/nzc_nm09.html)
>
I suspect that WT is compiling with newmat's option to use simulated
exceptions. Under this option, the SymmetricMatrix class will define
its own "new" statement. I found this to conflict with container
classes with another compiler and I suspect it is what is happening
here.
Robert
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: wada@ee.ibaraki.ac.jp (Wada Tatsuaki)
Date: 1998/09/28 Raw View
Could someone explain the differeces when compiling the same code with same
compiler but on different OS?
I'd like to build a STL vector of the SymmetricMatrix class of the free
newmat09 library. (http://nz.com/webnz/robert/nzc_nm09.html)
#include "newmatap.h" // need matrix applications
#include "newmatio.h" // need matrix output routines
#ifdef use_namespace
using namespace NEWMAT; // access NEWMAT namespace
#endif
#include <iostream>
#include <vector>
int main(){
vector< SymmetricMatrix > x (2);
return 0;
}
When I tried to compile the above program using egcs-1.1b on FreeBSD-2.2.7
with my PC-AT compatible machine, I got the following errors.
vecSymMat.cpp: 22 lines, 539 characters.
> g++ vecSymMat.cpp -I../newmat09 -L../newmat09 -lm -lnewmat
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.91.57/include/g++/
stl_constru
ct.h: In function `void construct<::NEWMAT::SymmetricMatrix, ::NEWMAT::Symmetric
Matrix>(class ::NEWMAT::SymmetricMatrix *, const class ::NEWMAT::SymmetricMatrix
&)':
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.91.57/include/g++/stl_uniniti
alized.h:172: instantiated from `__uninitialized_fill_n_aux<::NEWMAT::Symmetri
cMatrix *, unsigned int, ::NEWMAT::SymmetricMatrix>(::NEWMAT::SymmetricMatrix *,
unsigned int, const ::NEWMAT::SymmetricMatrix &, __false_type)'
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.91.57/include/g++/stl_uniniti
alized.h:182: instantiated from here
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.91.57/include/g++/stl_constru
ct.h:45: no matching function for call to `::NEWMAT::SymmetricMatrix::operator n
ew (unsigned int, ::NEWMAT::SymmetricMatrix *&)'
../newmat09/newmat.h:628: candidates are: ::NEWMAT::SymmetricMatrix::operator ne
w(size_t)
Could someone tell me how to get around it?
How can we constuct a vector of a userdefined class?
Should I write an allocator of SymmetricMatrix for constructing the vector?
The same program has compiled without any warnings using the same version
of egcs-1.1b on my Linux-alpha machine.
>gcc -v
Reading specs from /usr/local/lib/gcc-lib
/alphaev56-unknown-linux-gnu/egcs-2.91.
57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
What is the difference between them?
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]