Tao:
On 6/7/23 12:45, Tao Jin wrote:
> *** Caution: EXTERNAL Sender ***
>
> Dear Wolfgang,
>
> Here is a simple test code (I also attached the source code):
>
> int main()
> {
> using namespace dealii;
>
> const unsigned int *matrix_dimension* = 4;
>
> Tensor<2, matrix_dimension> myTensor;
>
> FullMatrix<double> myMatrix(matrix_dimension,
> matrix_dimension);
>
> for (unsigned int i = 0; i < matrix_dimension; i++)
> for (unsigned int j = 0; j < matrix_dimension; j++)
> {
> myMatrix(i,j) = i + j;
> }
>
> myMatrix.copy_to(myTensor);
>
> std::cout << myTensor.dimension << std::endl;
>
> return 0;
> }
>
> When *matrix_dimension =*2 or 3, the code works fine. When *matrix_dimension
> *= 4, it has a linking error as below:
> /error: undefined reference to 'void
> dealii::FullMatrix<double>::copy_to<4>(dealii::Tensor<2, 4, double>&, unsigned
> long, unsigned long, unsigned long, unsigned long, unsigned int, unsigned int)
> const'
> collect2: error: ld returned 1 exit status
> make[3]: *** [CMakeFiles/main.dir/build.make:116: main] Error 1/
>
> The version of deal.ii is 9.4.0.
I tried this out with the current development version (which will become 9.5
within the next few weeks) and it works just fine:
https://github.com/dealii/dealii/pull/15331
I am not sure what is going on here. In your code snippet, you call the
copy_to() function with one argument, but the error message refers to the
function with 7 arguments. Are you sure that this is the code you wanted to use?