I've developed code in C++ with LAPACKE and MPI on a Windows machine where the code compiles and works well. When I migrated the code to Linux(CentOS) server, the code failED to compile! The possible culprit is complex values declaration (in various forms). Details are listed below, please help!
--The code works well on Windows with GNU C++ version 4.9.2., Lapack/LAPACKE and MS MPI (MPICH2).
--The code does NOT compile on CentOS LINUX server. GNU C++ version is 4.4.7; MPI(MPICH2) works well on this Linux machine (tested with C++ codes without LAPACKE). The LAPACKE libraries I use on Windows are the same ones I use on Linux.
The errors I get when compiling on the Linux machine are related to declarations of complex values (scalars, arrays), and typically they are like this one error: expected unqualified-id before '__complex__'. Upon inspecting preprocessor output on both Win and Linux machines, I've noticed following (for example):
- If in the original source code you have declaration lapack_complex_double* HAMILTONIAN;, then
on the Windows machine you would see _lapack_complex_double* HAMILTONIAN; (which works well on Windows) and
on the Linux machine you would see double _Complex* HAMILTONIAN; which consequently gives error message during compilation stage.
More generally, I can see that the reported compilation errors on the Linux machine are pointing to places where complex in the original source is translated as _Complex in the preprocessor file, for the case of ordinary C++ variable; and for the case of LAPACKE variables when lapack_complex_double in the original source is translated as double _Complex. So, it seems like the problem is that compiler wrongly translates complex C++ type and similar LAPACKE types like lapack_complex_double[\b]. I've tried [b]#define _Complex complex , but (as expected) it didn't work - it solved problems on some places and created new problems on the other places.
Did you have experience with THE SAME or SIMILAR problem? Please help.
Thanks so much.