【VC】cl: 命令行 error D8016 :“/Ob2”和“/ZI”命令行选项不兼容

本文详细介绍了cl命令行errorD8016错误的原因及解决方法。主要涉及将属性设置为默认值来解决‘/Ob2’和‘/ZI’命令行选项不兼容的问题。通过调整优化设置,可以避免此错误并确保编译过程顺利进行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cl: 命令行 error D8016 :“/Ob2”和“/ZI”命令行选项不兼容


解决方法:

属性 -> C/C++ -> 优化 -> 内联函数展开 =  默认值

C:\Qt\Tools\CMake_64\share\cmake-3.30\Modules\CMakeTestCXXCompiler.cmake:73: error: The C++ compiler "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/HostX64/x64/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: 'C:/Qt/Examples/Qt-6.6.3/demos/calqlatr/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/CMakeFiles/CMakeScratch/TryCompile-p6qlk1' Run Build Command(s): C:/Qt/Tools/Ninja/ninja.exe -v cmTC_4f979 [1/2] "C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\cl.exe" /nologo /TP -DQT_QML_DEBUG /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd /showIncludes /FoCMakeFiles\cmTC_4f979.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_4f979.dir\ /FS -c C:\Qt\Examples\Qt-6.6.3\demos\calqlatr\build\Desktop_Qt_6_6_3_MSVC2019_64bit-Debug\CMakeFiles\CMakeScratch\TryCompile-p6qlk1\testCXXCompiler.cxx [2/2] C:\Windows\system32\cmd.exe /C "cd . && C:\Qt\Tools\CMake_64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_4f979.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- "C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_4f979.dir\testCXXCompiler.cxx.obj /out:cmTC_4f979.exe /implib:cmTC_4f979.lib /pdb:cmTC_4f979.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." FAILED: cmTC_4f979.exe C:\Windows\system32\cmd.exe /C "cd . && C:\Qt\Tools\CMake_64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_4f979.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- "C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_4f979.dir\testCXXCompiler.cxx.obj /out:cmTC_4f979.exe /implib:cmTC_4f979.lib /pdb:cmTC_4f979.pdb /version:0.0 /machine:x64 /d
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值