[vsipl++] Problem compiling VSIPL++ Matrix code

Rutledge, Edward rutledge at ll.mit.edu
Wed May 7 21:43:34 UTC 2008


Stefan,
That did fix one of the compile errors, but the other still occurs.


Here is the code that fails to compile:

#include <vsip/matrix.hpp>
#include <vsip/initfin.hpp>
#include <vsip/parallel.hpp>

int main(void)
{
  vsip::vsipl prog();
  const vsip::Matrix<vsip::scalar_i> constM(2,2,99);
  vsip::scalar_i a = constM(0,0); // fails to compile
  return 0;
}


Here is the output from the compiler:

% g++ -c Test.cc -I/tools/sourceryvsipl++/include
Test.cc: In function 'int main()':
Test.cc:9: error: passing 'const vsip::Matrix<int, vsip::Dense<2u, int, vsip::tuple<0u, 1u, 2u>, vsip::Local_map> >' as 'this' argument of 'typename vsip::impl::Lvalue_factory_type<Block>::type::reference_type vsip::Matrix<T, B>::operator()(vsip::index_type, vsip::index_type) [with T = int, Block = vsip::Dense<2u, int, vsip::tuple<0u, 1u, 2u>, vsip::Local_map>]' discards qualifiers


Thanks for your help,
-Eddie

___________________________

Edward Rutledge
MIT Lincoln Laboratory
244 Wood St
Lexington, MA 02420
781-981-0274
rutledge at ll.mit.edu
___________________________
-----Original Message-----
From: Stefan Seefeld [mailto:stefan at codesourcery.com]
Sent: Tuesday, May 06, 2008 4:40 PM
To: Rutledge, Edward
Cc: vsipl++ at codesourcery.com
Subject: Re: [vsipl++] Problem compiling VSIPL++ Matrix code

Edward,

Rutledge, Edward wrote:
> Hi,
>
> Using Sourcery VSIPL++ 1.4, I am trying to compile the following program
> but I get compile errors.  Looking at the VSIPL++ spec, I think this is
> a valid program.  Am I doing something wrong?

No you are not. I can confirm that this should work. Fortunately, there
is a simple work-around:

Insert an additional header on top:

#include <vsip/parallel.hpp>

With that the compile error will go away.

Obviously, we are going to fix this issue such that user code doesn't
have to include that header if they don't otherwise need it.

Thanks,
                Stefan

--
Stefan Seefeld
CodeSourcery
stefan at codesourcery.com
(650) 331-3385 x718



More information about the vsipl++ mailing list