I'm trying to use xlsLib for creating Excel spreadsheets from a C++ application.
The trouble is that compiling xlsLib, I give a .a file (a GCC static library, generated by MinGW). But, my application depends on another API (PhysX
) that only compiles with Visual Studio.
Thus: is it possible to transform the GCC static library (xlslib.a
) to a Visual Studio static library file (xlslib.lib
)?
a from MinGW. Since the MinGW makefile creates an import library in MSVC's lib format, the produced shared library (DLL) can be used from both MinGW and Microsoft Visual Studio with no further adaption. Just link to the import library FreeImage. lib from either MinGW or Microsoft Visual Studio.
To create a static library project in Visual Studio 2015On the menu bar, choose File > New > Project. In the New Project dialog box, select Installed > Templates > Visual C++ > Win32. In the center pane, select Win32 Console Application.
Examples of static libraries (libraries which are statically linked) are, . a files in Linux and . lib files in Windows.
The archives of static libraries generated with MinGW are generally compatible with Visual C++ compiler/linker. So, you should be able to use them directly by adding .a
files to linker input in your project properties in Visual Studio:
Properties
(Alt-F7).Configuration Properties->Linker->Input
.a
archives you need to uselibgcc.a
libraryAlso, there may occur problems regarding mixed C run-time libraries properties of C/C++->Code Generation->Runtime Library
, but this depends on your build configuration you use with MinGW. Sometimes it is necessary to link against libmsvcrt.a
from MinGW but in many (if not most) cases it causes problems.
Finally, this mixed MinGW and Visual C++ linking generally works but for C modules and it does not work for C++, as far as I know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With