vscode-cmake-tools
vscode-cmake-tools copied to clipboard
cmake.buildTask does not recognize errors
Brief Issue Summary
When using "cmake.buildTask" a debug run is started even if the build failed.
How to reproduce:
- Create a simple CMake project
- Add launch.json and tasks.json (see below)
- Set "cmake.buildTask" = true
- Build the project so that there is an executable
- Add a compile error
- Start debugging
=> The build will fail, but the debug will still start
CMake Tools Diagnostics
{
"os": "darwin",
"vscodeVersion": "1.83.0",
"cmtVersion": "1.16.10",
"configurations": [
{
"folder": "/Users/mtillmanns/projects/qt/qtc-work/master",
"cmakeVersion": "3.27.1",
"configured": true,
"generator": "Ninja",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/clang",
"CXX": "/usr/bin/clang++"
}
}
],
"cpptoolsIntegration": {
"isReady": false,
"hasCodeModel": false,
"activeBuildType": "",
"buildTypesSeen": [],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 0,
"executablesCount": 0,
"librariesCount": 0,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "never",
"configureOnOpen": false
}
]
}
Debug Log
n/a
Additional Information
My launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug Current Target",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"cwd": "${workspaceFolder}",
}
]
}
My tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake: Build the active target",
"command": "build",
"group": {
"kind": "build",
"isDefault": true
},
"detail": "CMake template build task",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": true
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": "absolute"
},
"options": {
"environment": {
"CMAKE_COLOR_DIAGNOSTICS": "1",
"CLICOLOR_FORCE": "1"
}
}
}
]
}
@Maddimax This is a good call-out, and thanks for the reproduction steps! Marking this as a bug and we will assess it when we can. Thanks!
Any chance this may be worked on? Its quite annoying :)
@gcampbell-msft We can reproduce this issue on latest CMake tools version v1.20.10(pre-release), you can get the details repro steps below. Thank you!
ENV: VSCode: 1.93.1 C/C++: 1.22.4 CMake tools: 1.20.10
Repro steps:
- Download this folder Test4.zip and open it with VSCode
- Click F1 to run command "
CMake: build" - Click F1 to run command "
Debug: start debugging" or click F5 - Check the output window
Actual result: The build fails because of a compilation error, but debugging starts unexpectedly
output logs:
[extension] [7859] cmake.launchTargetPath started
[main] Configuring project: Test4
[main] Saving open files before configure/build
[expand] expanded ${workspaceFolder}/build
[driver] Start configure
[driver] Running pre-configure checks and steps
[driver] Using compilers in Clang 18.1.3 x86_64-pc-windows-msvc for configure
[expand] expanded ${workspaceFolder}/build
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE with arguments ["-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files\\LLVM\\bin\\clang.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files\\LLVM\\bin\\clang++.exe","--no-warn-unused-cli","-SC:/Users/v-cathyzhang/Desktop/Test4","-Bc:/Users/v-cathyzhang/Desktop/Test4/build","-G","Ninja"]
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files\LLVM\bin\clang.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files\LLVM\bin\clang++.exe" --no-warn-unused-cli -SC:/Users/v-cathyzhang/Desktop/Test4 -Bc:/Users/v-cathyzhang/Desktop/Test4/build -G Ninja
[proc] with environment: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\v-cathyzhang\\AppData\\Roaming","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_15536_BOMGJJHYAMWIYDVL","CLIENTNAME":"MININT-4V16MFE","COMPUTERNAME":"vcathyzhang004","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ComSpec":"C:\\Windows\\system32\\cmd.exe","CommandPromptType":"Native","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DevEnvDir":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","EFC_1764":"1","ELECTRON_NO_ATTACH_CONSOLE":"1","ELECTRON_RUN_AS_NODE":"1","EXTERNAL_INCLUDE":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\include;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\ATLMFC\\include;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Auxiliary\\VS\\include;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um","ExtensionSdkDir":"C:\\Program Files (x86)\\Microsoft SDKs\\Windows Kits\\10\\ExtensionSDKs","Framework40Version":"v4.0","FrameworkDIR32":"C:\\Windows\\Microsoft.NET\\Framework\\","FrameworkDir":"C:\\Windows\\Microsoft.NET\\Framework\\","FrameworkVersion":"v4.0.30319","FrameworkVersion32":"v4.0.30319","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\v-cathyzhang","INCLUDE":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\include;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\ATLMFC\\include;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Auxiliary\\VS\\include;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um","LIB":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\ATLMFC\\lib\\x86;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\lib\\x86;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x86;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.22621.0\\ucrt\\x86;C:\\Program Files (x86)\\Windows Kits\\10\\\\lib\\10.0.22621.0\\\\um\\x86","LIBPATH":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\ATLMFC\\lib\\x86;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\lib\\x86;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\lib\\x86\\store\\references;C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.22621.0;C:\\Program Files (x86)\\Windows Kits\\10\\References\\10.0.22621.0;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319","LOCALAPPDATA":"C:\\Users\\v-cathyzhang\\AppData\\Local","LOGONSERVER":"\\\\vcathyzhang004","NETFXSDKDir":"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\","NUMBER_OF_PROCESSORS":"4","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","OneDrive":"C:\\Users\\v-cathyzhang\\OneDrive - Microsoft","OneDriveCommercial":"C:\\Users\\v-cathyzhang\\OneDrive - Microsoft","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"AMD64 Family 25 Model 1 Stepping 1, AuthenticAMD","PROCESSOR_LEVEL":"25","PROCESSOR_REVISION":"0101","PROMPT":"$P$G","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\","PUBLIC":"C:\\Users\\Public","Path":"C:\\Program Files\\LLVM\\bin;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\bin\\HostX86\\x86;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\VC\\VCPackages;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.1 Tools\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Team Tools\\DiagnosticsHub\\Collector;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\Extensions\\Microsoft\\CodeCoverage.Console;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\\\x86;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\\\x86;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\\\MSBuild\\Current\\Bin\\amd64;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\Tools\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\msys64\\mingw64\\bin;C:\\ProgramData\\chocolatey;C:\\msys64\\ucrt64\\bin;C:\\msys64\\mingw64\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja\\ninja.exe;C:\\Users\\v-cathyzhang\\Downloads\\ninja-win\\ninja.exe;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Git\\cmd;C:\\Users\\v-cathyzhang\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\v-cathyzhang\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\v-cathyzhang\\.dotnet\\tools;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\VC\\Linux\\bin\\ConnectionManagerExe;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\vcpkg","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SESSIONNAME":"RDP-Tcp#0","SystemDrive":"C:","SystemRoot":"C:\\Windows","TEMP":"C:\\Users\\V-CATH~1\\AppData\\Local\\Temp","TMP":"C:\\Users\\V-CATH~1\\AppData\\Local\\Temp","UATDATA":"C:\\Windows\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77","UCRTVersion":"10.0.22621.0","USERDNSDOMAIN":"fareast.corp.microsoft.com","USERDOMAIN":"FAREAST","USERDOMAIN_ROAMINGPROFILE":"FAREAST","USERNAME":"v-cathyzhang","USERPROFILE":"C:\\Users\\v-cathyzhang","UniversalCRTSdkDir":"C:\\Program Files (x86)\\Windows Kits\\10\\","VCIDEInstallDir":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\VC\\","VCINSTALLDIR":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\","VCPKG_ROOT":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\vcpkg","VCToolsInstallDir":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.40.33721\\","VCToolsRedistDir":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Redist\\MSVC\\14.40.33721\\","VCToolsVersion":"14.40.33721","VS140COMNTOOLS":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\","VS170COMNTOOLS":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\Tools\\","VSCMD_ARG_HOST_ARCH":"x86","VSCMD_ARG_TGT_ARCH":"x86","VSCMD_ARG_app_plat":"Desktop","VSCMD_VER":"17.11.0-pre.1.0","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"C:\\Users\\v-cathyzhang\\AppData\\Roaming\\Code\\CachedData\\38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\Users\\v-cathyzhang\\Desktop\\Test4","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\95fbdd7e-1.93.1-main-sock","VSCODE_L10N_BUNDLE_LOCATION":"","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en\",\"osLocale\":\"zh-cn\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"C:\\\\Users\\\\v-cathyzhang\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\resources\\\\app\\\\out\\\\nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_PID":"15536","VSINSTALLDIR":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\","VisualStudioVersion":"17.0","WindowsLibPath":"C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.22621.0;C:\\Program Files (x86)\\Windows Kits\\10\\References\\10.0.22621.0","WindowsSDKLibVersion":"10.0.22621.0\\","WindowsSDKVersion":"10.0.22621.0\\","WindowsSDK_ExecutablePath_x64":"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.1 Tools\\x64\\","WindowsSDK_ExecutablePath_x86":"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.1 Tools\\","WindowsSdkBinPath":"C:\\Program Files (x86)\\Windows Kits\\10\\bin\\","WindowsSdkDir":"C:\\Program Files (x86)\\Windows Kits\\10\\","WindowsSdkVerBinPath":"C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\","__DOTNET_ADD_32BIT":"1","__DOTNET_PREFERRED_BITNESS":"32","__VSCMD_PREINIT_PATH":"C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\msys64\\mingw64\\bin;C:\\ProgramData\\chocolatey;C:\\msys64\\ucrt64\\bin;C:\\msys64\\mingw64\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin;C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja\\ninja.exe;C:\\Users\\v-cathyzhang\\Downloads\\ninja-win\\ninja.exe;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Git\\cmd;C:\\Users\\v-cathyzhang\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\v-cathyzhang\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\v-cathyzhang\\.dotnet\\tools","windir":"C:\\Windows"}
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is Clang 18.1.3 with GNU-like command-line
[cmake] -- The CXX compiler identification is Clang 18.1.3 with GNU-like command-line
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe
[cmake] -- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe - broken
[cmake] CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Preview/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/Program Files/LLVM/bin/clang.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: 'C:/Users/v-cathyzhang/Desktop/Test4/build/CMakeFiles/CMakeScratch/TryCompile-k63hvt'
[cmake]
[cmake] Run Build Command(s): C:/PROGRA~1/MIB055~1/2022/Preview/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe -v cmTC_63c2d
[cmake] [1/2] C:\PROGRA~1\LLVM\bin\clang.exe -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -MD -MT CMakeFiles/cmTC_63c2d.dir/testCCompiler.c.obj -MF CMakeFiles\cmTC_63c2d.dir\testCCompiler.c.obj.d -o CMakeFiles/cmTC_63c2d.dir/testCCompiler.c.obj -c C:/Users/v-cathyzhang/Desktop/Test4/build/CMakeFiles/CMakeScratch/TryCompile-k63hvt/testCCompiler.c
[cmake] [2/2] C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\clang.exe -fuse-ld=lld-link -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console CMakeFiles/cmTC_63c2d.dir/testCCompiler.c.obj -o cmTC_63c2d.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:cmTC_63c2d.lib -Xlinker /pdb:cmTC_63c2d.pdb -Xlinker /version:0.0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
[cmake] FAILED: cmTC_63c2d.exe
[cmake] C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\clang.exe -fuse-ld=lld-link -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console CMakeFiles/cmTC_63c2d.dir/testCCompiler.c.obj -o cmTC_63c2d.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:cmTC_63c2d.lib -Xlinker /pdb:cmTC_63c2d.pdb -Xlinker /version:0.0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
[cmake] lld-link: error: <root>: undefined symbol: mainCRTStartup
[cmake] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[cmake] ninja: build stopped: subcommand failed.
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:2 (project)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files\LLVM\bin\clang.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files\LLVM\bin\clang++.exe" --no-warn-unused-cli -SC:/Users/v-cathyzhang/Desktop/Test4 -Bc:/Users/v-cathyzhang/Desktop/Test4/build -G Ninja exited with code: 1
[main] Configuration of project failed.
[main] =======================================================
[main] No executable target was found to launch. Please check:
[main] - Have you called add_executable() in your CMake project?
[main] - Have you executed a successful CMake configure?
[main] No program will be executed
[extension] [7859] cmake.launchTargetPath finished (returned null)
This issue also causes the problems tab to not get populated. So when there are linker errors they are missed. It might be a different issue but i think its the same root cause. I have found that the for the case of my issue it could be fix by changing a consumer/add a consumer to the output of the CustomBuildTaskTerminal that gets spawned.
@PILIX123 thanks for your comment! I cannot repro your issue on CMake Tools v1.20.53, the compile error appears on the problems tab when there are linker errors, I have recorded a video for this process, please correct me if I have done something wrong.
i will look into this further later this week thanks @Amy-Li03
if you add a extern void foo(void); to make the compiler happy you might face the error i was facing. @Amy-Li03 Should i also make a new issue because it might not be related?
if you add a
extern void foo(void);to make the compiler happy you might face the error i was facing. @Amy-Li03 Should i also make a new issue because it might not be related?
@PILIX123 Sure, go ahead — opening a new issue makes sense if it's potentially unrelated.