| MSVC Version | Qt 5.15.2 Binary Compatibility | Notes |
|---|---|---|
| MSVC 2017 (v141) | ✅ Fully compatible Officially | supported by Qt 5.15.2 |
| MSVC 2019 (v142) | ✅ Safe and widely used | Common choice for Qt 5.15.2 builds |
| MSVC 2022 (v143) | ⚠️ Conditionally compatible | May require you to rebuild Qt 5.15.2 from source |
Qt binaries are compiler-specific. For example, binaries built for MSVC 2019 cannot be safely linked with code compiled using MSVC 2022.
compiler flags
| flags | meaning | notation |
|---|---|---|
/wd4514 |
warning C4514: ‘function’ : unreferenced inline function has been removed | |
/wd4267 |
warning C4267: ‘var’ : conversion from ‘size_t’ to ‘type’, possible loss of data | On Linux (gcc/clang), similar conversions usually do not warn by default, so when porting to MSVC the project suddenly produces hundreds of warnings. Many projects therefore disable it. |
/bigobj |
fatal error C1128: number of sections exceeded object file format limit | |
WINDOWS_EXPORT_ALL_SYMBOLS |
CMake generates exports even when the source code has no __declspec(dllexport). | |
/W0 |
disables all warnings | |
/IGNORE:4099 |
disables specific linker warning |
usage of flags
target_compile_options(my_target PRIVATE
/wd4514
/wd4267
/bigobj
)
build with cmake
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
# -S . → source directory
# -B build → build directory
# -G "Visual Studio 17 2022" → generator
# -A x64 → build for 64-bit
# compile with multiple processors
cmake --build . --config Release -- /p:UseMultiToolTask=true
qa
no lib file after shared library generation
If no interface is exported, there won’t be lib file.
###
invalid or corrupt file: cannot read at 0x2F8
reason
added libprotobuf.dll to the linker inputs instead of libprotobuf.lib or protobuf.lib.
solution
replace target_link_libraries(your_target PRIVATE ${Protobuf_LIBRARIES}) with target_link_libraries(your_target PRIVATE protobuf::libprotobuf).
###
definition of dllimport static data member not allowed