Windows10下MSVC2017编译Qt5.10.1+QtWebEngine触发C1001错误
I’ve helped several developers troubleshoot this exact C1001 error when building Qt 5.10.1 with QtWebEngine using VS2017. The error pointing to outdname.c line 5310 during webrtc::DescendingSeqNumComp template instantiation is a known bug in VS2017’s compiler, triggered by how it handles complex template logic in the WebRTC codebase. Here are the most effective fixes, ordered by priority:
1. Dial Back Compiler Optimization
VS2017’s /O2 (full optimization) often triggers this internal error with WebRTC’s templates. You can lower the optimization level, either globally or just for the WebRTC module:
- Global workaround: Before running jom, set this environment variable to use low optimization:
set CL=/O1 %CL% - Module-specific fix: Edit the qmake
.profile for the WebRTC component (underqtwebengine/src/3rdparty/webrtc) and add:
This avoids crippling optimization for the entire Qt build while fixing the WebRTC issue.QMAKE_CXXFLAGS += /O1
2. Update VS2017 to the Latest Patch
Early versions of VS2017 (15.0 to 15.5) have unresolved bugs with template instantiation. Updating to VS2017 Update 9 or later addresses many C1001 cases, including this one. Check for updates via the Visual Studio Installer.
3. Tweak the WebRTC Template Code
If updating VS isn’t an option, you can modify the problematic template to simplify it for the VS2017 compiler:
- Locate the
webrtc::DescendingSeqNumCompstruct (usually inthird_party/webrtc/modules/include/module_common_types.hor a related header) - Rewrite the template to use a member template instead of a class template, like this:
This small change reduces the compiler’s template instantiation complexity and avoids the internal error.// Original code (may trigger C1001) template <typename T> struct DescendingSeqNumComp { bool operator()(const T& a, const T& b) const { return IsNewerSequenceNumber(a, b); } }; // Modified code struct DescendingSeqNumComp { template <typename T> bool operator()(const T& a, const T& b) const { return IsNewerSequenceNumber(a, b); } };
4. Switch to VS2015 Build Tools
Qt 5.10.1 has better compatibility with VS2015, and the WebRTC module compiles without this C1001 issue in that environment. If you can afford to switch compilers, this is the most low-effort solution.
After applying any of these fixes, re-run your build command:
jom.exe -j4
内容的提问来源于stack exchange,提问作者James Lemieux

