MingW, MSVC, GFortran: Link libraries
-
I'm developing a main Qt GUI C++ application that calls some Fortran-90 functions and subroutines inside of it.
This application must be cross-platform: Windows, Linux and Mac OSX.
I know that my C++ compiler MUST be compatible with my Fortran compiler.
So, to build my application I'm thinking of use these combinations below:For Windows 10:
- C++: MSVC++ 2019
- Fortran: Intel Fortran Compiler 2019
For Linux (Ubuntu 20.04):
- C++: GCC 9.3
- Fortran: gfortran 9.3
For OSX:
- C++: GCC 9.3
- Fortran: gfortran 9.3
Looking this info above, I think that will be good to try to use a single compilers pair to ALL targets.
So, using
Qt Maintenance
I downloaded and installed the Mingw-w64-8.1 compilers and tools.My first problem using the Qt + MingW is that:
My Qt project need to link some libraries.
The Windows compiled static libraries are in the project folder and the file extension is*.lib
The Linux and OSX libraries are in the project include paths.Trying to build a Windows binary with GCC:
When I use Qt + MSVC...I got no linker errors and all works fine.
But when change the Qt configurations to use Qt + Mingw the linker starts to search for a*.a
library and NOT a*.lib
library.I'm a little bit confuse. I downloaded MingW to be possible to generate Windows builds using GCC. In that way, I think that the linker libraries should be the same as always
*.lib
. Right?What is wrong?
Thank,
My systems are:
System A:
- Windows 10 x64
- Qt Creator 4.12.4
- Qt 5.15
System B:
- Ubuntu 20.04 x64
- Qt Creator 4.12.4
- Qt 5.15
System C:
- OSX Catalina
- Qt Creator 4.12.4
- Qt 5.15
-
@fem_dev said in MingW, MSVC, GFortran: Link libraries:
Right?
No.
MSVC uses .lib suffix for import libs, MinGW/gcc .a
And since you can't mix MSVC and MinGW/gcc c++ libraries you have to compile all dependencies with the same compiler.use a single compilers pair to ALL targets.
I don't understand this - do you try to cross-compile?
-
@fem_dev said in MingW, MSVC, GFortran: Link libraries:
Right?
No.
MSVC uses .lib suffix for import libs, MinGW/gcc .a
And since you can't mix MSVC and MinGW/gcc c++ libraries you have to compile all dependencies with the same compiler.use a single compilers pair to ALL targets.
I don't understand this - do you try to cross-compile?
@Christian-Ehrlicher Ok! I understood now.