Eigen::Matrix<std::complex<double>
and passing a Eigen::MatrixXcd
but that doesn't seem to fix the error either.
|
|
|
|
no instance of overloaded function "aapx" matches the argument list argument types are: (Eigen::Matrix<std::_Complex<double>, 11, 10, 0, 11, 10>, Eigen::Matrix<std::_Complex<double>, 11, 10, 0, 11, 10>, Eigen::Matrix<std::_Complex<double>, 11, 10, 0, 11, 10>) |
const
void aapx(const Eigen::Ref<const Eigen::MatrixXcd>& uh, Eigen::Ref<const Eigen::MatrixXcd>& vh, Eigen::Ref<const Eigen::MatrixXcd>& ph){
cppreference wrote: |
---|
Multiple functions in the same scope may have the same name, as long as their parameter lists and, for non-static member functions, cv/ref (since C++11)-qualifications are different. This is known as function overloading. Function declarations that differ only in the return type and the noexcept specification (since C++17) cannot be overloaded. The address of an overloaded function is determined differently. |
I can post the full code, it's just the function is a bit long. |
const
:
|
|
|
|
const
might be a problem, I meant in respect to overloaded functions, but can you explain why you need an overloaded function there? There weren't any examples in the link you posted.I know that an Eigen::Matrix should always be passed by reference to a function so I did and I thought maybe the issue is I am initializing a Eigen::Matrix<std::complex<double> and passing a Eigen::MatrixXcd but that doesn't seem to fix the error either. |
const
Eigen::Ref<const Eigen::MatrixXcd>& but the other two are Eigen::Ref<const Eigen::MatrixXcd>& (no const at the front)10.0
not 10 which is an int
and causes the compiler to do an implicit cast. This can be a problem with templated functions.
|
|
But you are initialising and passing as Eigen::Matrix<std::complex<double> , but the function expects a Eigen::Ref<const Eigen::MatrixXcd>& Note the first parameter is a const Eigen::Ref<const Eigen::MatrixXcd>& but the other two are Eigen::Ref<const Eigen::MatrixXcd>& (no const at the front) |
Eigen::MatrixXcd
does not solve the problem.
|
|
const Eigen::Ref<const Eigen::MatrixXf>&
but just Eigen::MatrixXf
Note how the example doesn't initialize and pass a as const Eigen::Ref<const Eigen::MatrixXf>& but just Eigen::MatrixXf |
const
, just that const
is a problem for overload resolution. But it sounds like you shouldn't have overloaded functions anyway.static const int mm = nx* 3/2;
static const int mm = (nx* 3) / 2;
But why is the compiler complaining about overloaded functions? Try putting your aapx function in it's own namespace so it doesn't clash with some other aapx function somewhere else |
In file included from arithmeticFunctions3D.cpp:6: spectralFunctions3D.h:15:17: error: ‘Eigen’ is not a namespace-name 15 | using namespace Eigen; | ^~~~~ In file included from arithmeticFunctions3D.cpp:6: spectralFunctions3D.h:21:17: error: ‘Eigen’ does not name a type 21 | void aapx(const Eigen::Ref<const Eigen::MatrixXcd>& uh, const Eigen::Ref<const Eigen::MatrixXcd>& vh, Eigen::Ref<const Eigen::MatrixXcd> ph); | ^~~~~ spectralFunctions3D.h:21:27: error: expected unqualified-id before ‘<’ token 21 | void aapx(const Eigen::Ref<const Eigen::MatrixXcd>& uh, const Eigen::Ref<const Eigen::MatrixXcd>& vh, Eigen::Ref<const Eigen::MatrixXcd> ph); | ^ spectralFunctions3D.h:21:27: error: expected ‘)’ before ‘<’ token 21 | void aapx(const Eigen::Ref<const Eigen::MatrixXcd>& uh, const Eigen::Ref<const Eigen::MatrixXcd>& vh, Eigen::Ref<const Eigen::MatrixXcd> ph); | ~ ^ | ) spectralFunctions3D.h:21:27: error: expected initializer before ‘<’ token |
error: ‘Eigen’ is not a namespace-name 15 | using namespace Eigen; |
using namespace Eigen;
? Just leave it with everything qualified with Eigen::
|
|
|
|
std::
and Eigen::
repectively where required.#include <Eigen/Dense>
all I care about is testing the function aapx in Test.cpp. |
eigen/Eigen/src/Core/MapBase.h:37:34: error: passing ‘const Eigen::internal::variable_if_dynamic<long int, -1>’ as ‘this’ argument discards qualifiers [-fpermissive] // ... spectralFunctions3D.cpp:228:44: required from here |
|
|
ld.lld: error: duplicate symbol: my_fftw_allocate_real(int, int) >>> defined at Test.cpp:61 >>> /tmp/ccezRTyF.o:(my_fftw_allocate_real(int, int)) >>> defined at spectralFunctions3D.cpp:52 >>> /tmp/cc14RAhJ.o:(.text+0x0) ld.lld: error: duplicate symbol: my_fftw_allocate_cplx(int, int) >>> defined at Test.cpp:62 >>> /tmp/ccezRTyF.o:(my_fftw_allocate_cplx(int, int)) >>> defined at spectralFunctions3D.cpp:53 >>> /tmp/cc14RAhJ.o:(.text+0x65) ld.lld: error: duplicate symbol: print_matrix(cplx_buffer const&) >>> defined at Test.cpp:65 >>> /tmp/ccezRTyF.o:(print_matrix(cplx_buffer const&)) >>> defined at spectralFunctions3D.cpp:56 >>> /tmp/cc14RAhJ.o:(.text+0xCA) ld.lld: error: duplicate symbol: print_matrixR(real_buffer const&) >>> defined at Test.cpp:81 >>> /tmp/ccezRTyF.o:(print_matrixR(real_buffer const&)) >>> defined at spectralFunctions3D.cpp:72 >>> /tmp/cc14RAhJ.o:(.text+0x201) collect2: error: ld returned 1 exit status |
(0.0000,0.0000) (0.0000,0.0000) (1194.7556,0.0000) (-0.0000,0.0000) (1194.7556,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (-0.0000,0.0000) (0.0000,-0.0000) (1011.2950,0.0000) (-0.0000,-0.0000) (1011.2950,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (-0.0000,0.0000) (0.0000,0.0000) (595.5283,-0.0000) (0.0000,-0.0000) (595.5283,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,-0.0000) (217.0802,0.0000) (0.0000,-0.0000) (217.0802,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (33.1877,0.0000) (0.0000,-0.0000) (33.1877,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (1.8495,0.0000) (0.0000,-0.0000) (1.8495,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,-0.0000) (1.4138,0.0000) (-0.0000,-0.0000) (1.4138,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (-0.0000,0.0000) (0.0000,-0.0000) (33.1877,-0.0000) (0.0000,-0.0000) (33.1877,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (-0.0000,0.0000) (0.0000,-0.0000) (97.7172,0.0000) (0.0000,-0.0000) (97.7172,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,-0.0000) (132.7506,0.0000) (0.0000,-0.0000) (132.7506,-0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) (0.0000,0.0000) |
|
|
Also note that the header guard at the top of spectralFunctions3D has a typo: #ifndef spectralFUN_H #define spectralFUBN_H |
Don't see the typo |
I was struggling with adding my struct in the header files, but I will follow with what you did and try running it again. |
|
|
|
|