I am not sure whether it is a MAC problem or not.
I am new to mac programming.
Recently I am trying to learn program with MTL4(http://www.osl.iu.edu/research/mtl/mtl4/doc/manual.php3).
Here is a sample program copied from MTL document. It is a very simple program which implements a complex vector and prints it out by using MTL.
I tried to compile it under terminal, and got the following error:
why the compiler can't do a auto conversion for me?
My OS is Leopard,
g++ version:
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
any advise?
thx in advance.
I am new to mac programming.
Recently I am trying to learn program with MTL4(http://www.osl.iu.edu/research/mtl/mtl4/doc/manual.php3).
Here is a sample program copied from MTL document. It is a very simple program which implements a complex vector and prints it out by using MTL.
Code:
// File: vector2.cpp
#include <complex>
#include <iostream>
#include <boost/numeric/mtl/mtl.hpp>
int main(int argc, char* argv[])
{
using namespace mtl;
// Define dense vector of complex with 7 elements.
dense_vector<std::complex<float>, vector::parameters<tag::row_major> > v(7);
// Set all elements to 3+2i
v= std::complex<float>(3.0, 2.0);
std::cout << "v is " << v << "\n";
// Set all elements to 5+0i
v= 5.0;
std::cout << "v is " << v << "\n";
v= 6;
std::cout << "v is " << v << "\n";
return 0;
}
I tried to compile it under terminal, and got the following error:
$ g++ -I/usr/Local/MTL4 -I/usr/local/boost_1_34_1 Vector2.cpp -o Vector2 -lm -O2
Vector2.cpp: In function int main(int, char**):
Vector2.cpp:15: error: incompatible types in assignment of std::complex<float> to mtl::vector::dense_vector<std::complex<float>, mtl::vector:arameters<mtl::tag::row_major, mtl::vector::non_fixed::dimension, false, false> > [7]
Vector2.cpp:19: error: incompatible types in assignment of double to mtl::vector::dense_vector<std::complex<float>, mtl::vector:arameters<mtl::tag::row_major, mtl::vector::non_fixed::dimension, false, false> > [7]
Vector2.cpp:22: error: incompatible types in assignment of int to mtl::vector::dense_vector<std::complex<float>, mtl::vector:arameters<mtl::tag::row_major, mtl::vector::non_fixed::dimension, false, false> > [7]
why the compiler can't do a auto conversion for me?
My OS is Leopard,
g++ version:
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
any advise?
thx in advance.