franneck94 / Vscode-C-Cpp-Runner

🚀 Compile, run and debug single or multiple C/C++ files with ease. 🚀
MIT License
53 stars 14 forks source link

How can I select the desired Compiler? #57

Closed wm1962 closed 2 years ago

wm1962 commented 2 years ago

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?

franneck94 commented 2 years ago

Hi, for C++ code this is the correct setting:

"C_Cpp_Runner.cppCompilerPath": "/usr/bin/g++",

wm1962 commented 2 years ago

ok, but how can I select the C++ compiler in VSC / Cpp_Runner?

franneck94 commented 2 years ago

Just edit the setting that i posted above in the settings.json file to a path where you have installed a compiler

wm1962 commented 2 years ago

Sorry, you misunderstand me: How can I choose the c++ compiler, by default gcc ist activated. I only want to activate c++ as default?

franneck94 commented 2 years ago

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.

wm1962 commented 2 years ago

yes, but i want to compile my c-code sometimes with the g++ compiler. How can I do this?

franneck94 commented 2 years ago

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.