'Do libraries compiled with MinGW work with MSVC?
Problem:
I would use a MinGW library in Visual Studio project.
How my system is built:
I downloaded ZBar library for my Windows 10 system ( zbar-0.23.91-win_x86_64-DShow.zip
This is the link: https://linuxtv.org/downloads/zbar/binaries/).
I have these files in the folder of lib and bin:
- libzbar.a
- libzbar.dll.a
- libzbar.la
- libzbar-0.dll
Error when build:
error LNK2019: unresolved external symbol __mingw_vsnprintf referenced in snprintf
My question
Do libraries compiled with MinGW work with MSVC?
Solution 1:[1]
The problem is that the libraries have been compiled with mingw while I need to compile them in an mscv project.
The solution was to rebuild the library with Visual Studio.
It was possible to use everything without problems.
Solution 2:[2]
You can use C-lion because It has direct support of MinGW. A sample tutorial for how to select MinGW as a toolchain in C-lion is given in this link.
https://www.jetbrains.com/help/clion/how-to-create-toolchain-in-clion.html#custom-targets-toolchain
Using this you will have direct access to all the libraries available for MinGW directly.
Solution 3:[3]
No it can't. A library compiled with MinGW will only work with MinGW. You need to compile it from source code with MSVC.
I haven't used windows much and hardly used visual studio. But you can use MinGW on visual studio ide if you want.
Using MinGW with Visual Studio IDE
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | EliaTolin |
| Solution 2 | Abdul ahad |
| Solution 3 | Keshav Sahu |

