Re: mtl ON VC6

Kavran Peter <[email protected]> Fri, 23 Sep 2005 10:58:08 +0200
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <1127465888.2756.1.camel@iardp001>
I think you should define external vectors as this:
typedef external_vec<double> ExtVector;

Cheers

Peter


On Fri, 2005-09-23 at 09:52, Xu Bin wrote:
> hi,
> I'm new to MTL and I copied the following code:
> 
> #include 
> 
> "mtl/mtl.h"
> 
> #include 
> 
> "mtl/utils.h"
> 
> #include 
> 
> "mtl/linalg_vec.h"
> 
>  
> 
> using
> 
> namespace mtl;
> 
> using
> 
> namespace std;
> 
> int
> 
> main
> 
> () 
> 
> {
> 
> //begin
> 
> const int N = 3;
> 
> double dx[] = { 1, 2, 3};
> 
> double dy[] = { 3, 0, -1};
> 
> typedef external_vec Vec;
> 
> Vec x(dx,N), y(dy,N );
> 
> print_vector(x);
> 
> print_vector(y);
> 
> double dotprd = dot(x, y);
> 
> if (dotprd == 0)
> 
> cout << "Vectors x and y are orthogonal." << endl;
> 
> else
> 
> cout << "dot(x,y) = " << dotprd << endl;
> 
> //end
> 
> return 0;
> 
> }
> 
> 
>  to my VC6 compiler and compiled it but there are some errors as
> follow:
>  
> :\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2955:
> 'external_vec' : use of class template requires template argument list
>         c:\my
> work\numerical\mtl\mtl-2.1.2-20\mtl-2.1.2-20\mtl\linalg_vec.h (555) :
> see declaration of 'external_vec'
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2514:
> 'mtl::external_vec' : class has no constructors
>         c:\my
> work\numerical\mtl\mtl-2.1.2-20\mtl-2.1.2-20\mtl\linalg_vec.h (555) :
> see declaration of 'external_vec'
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2262:
> 'x' : cannot be destroyed
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2955:
> 'external_vec' : use of class template requires template argument list
>         c:\my
> work\numerical\mtl\mtl-2.1.2-20\mtl-2.1.2-20\mtl\linalg_vec.h(555) :
> see declaration of 'external_vec'
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2514:
> 'mtl::external_vec' : class has no constructors 
>         c:\my
> work\numerical\mtl\mtl-2.1.2-20\mtl-2.1.2-20\mtl\linalg_vec.h(555) :
> see declaration of 'external_vec'
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(34) : error C2262:
> 'y' : cannot be destroyed
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(36) : error C2670:
> 'print_vector' : the template function cannot convert parameter 1 from
> type 'class mtl::external_vec'
> C:\MY WORK\NUMERICAL\LAPACK++\MY TEST\mtl1\11.cpp(37) : error C2670:
> 'print_vector' : the template function cannot convert parameter 1 from
> type 'class mtl::external_vec' 
> Error executing cl.exe.
> 
> Can any one give me some suggestions? Thanks
> -- 
> xubin 
> 
> ______________________________________________________________________
> _______________________________________________
> This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/