Using Qt 5.15.0 in Visual Studio 2019 with the Qt VS Tools
extension installed.
#include <QVector>
int main()
{
QVector<int> myList;
return 0;
}
The above minimal program builds in RELEASE mode, but gives link errors in DEBUG mode:
error LNK2019: unresolved external symbol __imp__invalid_parameter referenced in function "void __cdecl std::_Load_barrier(enum std::memory_order)"
error LNK2019: unresolved external symbol __imp__CrtDbgReport referenced in function "void __cdecl std::_Load_barrier(enum std::memory_order)"
fatal error LNK1120: 2 unresolved externals
I stumbled on this question which gave me the hint about the build configuration. In Project Properties > Qt Project Settings
, I was not able to identify the setting that needs to change.
How do I resolve this issue?
Update 1
Some additional configuration details (suggested in a comment):
- Simple Visual Studio
.sln
file (no CMake) which loads a.vcxproj
project - Qt was downloaded and is installed to
C:\Qt
Update 2
Additional details from the Visual Studio project (.vcxproj
) file based on a comment. This is how Qt is referenced for Debug/Release builds:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>msvc2019_64</QtInstall>
<QtModules>core</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>msvc2019_64</QtInstall>
<QtModules>core</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>