|
Ublas : |
From: djdb684_at_[hidden]
Date: 2006-05-11 00:20:49
Hi Dvir,
Your link-error is typical for the case of using the C-compiler 'gcc' instead of the C++ compiler g++.
Please try 'g++ test_b2.cpp' instead. Your source-code worked fine for me under cygwin with GCC version 3.2.3, resulting in cout of 'm1=[3,3]((0,1,2),(3,4,5),(6,7,8))'. ( Please note that while the GNU suite of C/C++ compilers is called GCC, the C++ compiler is actually the g++.exe! )
If that's not the reason for the undefined reference please give more details about the compiler and environment that you're using.
BTW, you may also want to change the deprecated <iostream.h> header for the newer <iostream> header. Nor is <stdio.h> needed for namespace std components; its a C header file for the likes of printf.
Best wishes, and good luck!
Dieter Beaven
---- Original message ----
>Date: Wed, 10 May 2006 14:50:27 +0300
>From: "dvir schirman" <dvir.boost_at_[hidden]>
>Subject: [ublas] getting started?
>To: ublas <ublas_at_[hidden]>
>
> Hi.
>
> I want to use ublas in order to work with vector &
> matrices.
> I am working with cygwin.
>
> I wrote the following simple code, it compiled well,
> but I tried to link it it has returned alott of
> errors.
> the first error is:
> "/cygdrive/z/test_boost/test_b2.cpp:(.text+0xd):
> undefined reference to `std::basic_string<char,
> std::char_traits<char>, std::allocator<char>
> >::size() const'"
> And after this one there are alott of similiar ones
> mostly regarding "std".
>
> Hope youy can help me with this.
> Dvir
>
>
> #include
>
> <boost/numeric/ublas/matrix.hpp>
>
> #include
>
> <boost/numeric/ublas/io.hpp>
>
> #include
>
> <boost/numeric/ublas/matrix_proxy.hpp>
>
> #include
>
> <iostream.h>
>
> #include
>
> <stdio.h>
>
>
>
> namespace
>
> ublas = boost::numeric::ublas;
>
> int
>
> main ()
>
> {
>
> using namespace boost::numeric::ublas;
>
> using namespace std;
>
>
>
> matrix<
>
> float> m1 (3, 3);
>
>
>
> for
>
> (unsigned i = 0; i < m1.size1 (); ++ i)
>
> for (unsigned j = 0; j < m1.size2 (); ++ j)
>
> m1 (i, j) = 3 * i + j;
>
> std::cout<<"m1="<<m1<<endl;
>
> return
>
> 1;
>
> }
>
>
>________________
>_______________________________________________
>ublas mailing list
>ublas_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/ublas