Closed wm1962 closed 2 years ago
Hi, for C++ code this is the correct setting:
"C_Cpp_Runner.cppCompilerPath": "/usr/bin/g++",
ok, but how can I select the C++ compiler in VSC / Cpp_Runner?
Just edit the setting that i posted above in the settings.json file to a path where you have installed a compiler
Sorry, you misunderstand me: How can I choose the c++ compiler, by default gcc ist activated. I only want to activate c++ as default?
Yes I really don't understand you. You want to disable this extension for c code and only use for c++?
Or maybe you have a misunderstanding, gcc is a c Compiler and g++ is a c++ Compiler and not vice versa.
yes, but i want to compile my c-code sometimes with the g++ compiler. How can I do this?
Why should you do this instead of just using gcc?
Anyway, you could set the cCompilerPath to your g++ installation. If compilation throws errors then it is related to using g++ for C.
For changing the compiler there's a note in the wiki:
All settings will be stored in the local workspace settings (".vscode/settings.json"). If you wish to use any other compiler or different setting, just edit the entries in the local settings file.
my settings.json looks like .
{ "C_Cpp_Runner.cCompilerPath": "/usr/bin/gcc", "C_Cpp_Runner.cppCompilerPath": "/usr/bin/g++", "C_Cpp_Runner.debuggerPath": "/usr/bin/gdb", "C_Cpp_Runner.warnings": [ "-Wall", "-Wextra", "-Wpedantic" ], "C_Cpp_Runner.compilerArgs": [ ], "C_Cpp_Runner.includePaths": [ "${workspaceFolder}/src/lib/Nextion" ], "C_Cpp_Runner.linkerArgs": [ ], "C_Cpp_Runner.cStandard": "", "C_Cpp_Runner.cppStandard": "", "C_Cpp_Runner.excludeSearch": [], "C_Cpp_Runner.enableWarnings": true, "C_Cpp_Runner.warningsAsError": false, "files.associations": { }, "C_Cpp_Runner.msvcBatchPath": "", "C_Cpp_Runner.includeSearch": [ "*", "**/*" ] }
gcc is the actual compiler, in which line can I set the g++ for the actual compiler?