Closed Demonese closed 3 months ago
Thank you for reporting this issue. As a quick fix, you can edit your local kit using this command: "Edit User-Local CMake Kits
" in which you can change the path to the compiler.
As a quick fix, you can edit your local kit using this command: "
Edit User-Local CMake Kits
" in which you can change the path to the compiler.
My solution is edit CMakeTools/cmake-tools-kits.json file manually and avoid clicking the scan button until the problem is fixed.
Got this issue too on a clean Ubuntu 22.04 install in a VirtualBox. Simply installing g++
with sudo apt install -y g++
seems to fix the issue for me.
@aviborg Thanks for the solution, this is the correct fix for this issue, the tools need to be installed. Thanks!
@aviborg Thanks for the solution, this is the correct fix for this issue, the tools need to be installed. Thanks!
I think this assessment isn't correct. I ran into the same issue with a frsh install of Ubuntu 24.04 (in wsl). Then I did:
sudo apt install cmake
This will pull in gcc but only as a C compiler. The C compiler is working fine.
When lauching vscode with vscode-cmake-tools installed and scanning for kits the extension comes up with:
[
{
"name": "GCC 13.2.0 x86_64-linux-gnu",
"compilers": {
"C": "/usr/bin/c89-gcc"
},
"isTrusted": true
}
]
The problem is that /usr/bin/c89-gcc
is just a shell wrapper around gcc that automatically applies -std=c89
. This will give you a C compiler that doesn't accept other flags like -std=c11
or -std=gnu17
. So it is kinda crippled and will fail if a cmake script requests a higher C standard version.
While installing g++
is a workaround it should NOT be required and doesn't seem to be the correct solution to me. Why would you require users to install a C++ compiler if they only require C. This isn't a requirement that cmake introduces as it will work perfectly fine if the project
in CMakeLists.txt
specifies C
as a language like this:
project(myproject C)
IMHO the code in vscode-cmake-tools should not pick up those shell warppers that hard code certain C standards as this isn't what cmake want's to see as the compiler executable. I think the code searching for kits should either ignore the shell wrappers or list them as separate kits.
Could you please reopen this issue?
Brief Issue Summary
This problem prevents me from compiling the code with C17 (because of c89-gcc).
System: Ubuntu 22.04 LTS
Result of [Scan of Kits]:
Result of CMakeTools/cmake-tools-kits.json
CMake Tools Diagnostics
Debug Log
No response
Additional Information
I only install the latest stable version of gcc: