I am making a c++ program in vscode.
And i want to compile the c++ program using a specific command (for example g++ file_name.cpp -o file_name.exe). But cant understand how to do it using tasks in vscode?
All i want is to be able to run the above compilation command on the powershell in vscode. How can i do it??
Add a comment
|
2 Answers
I recently found out how to do it.
- You can download the coderunner extension in vscode.
- Then go to the settings of this extension.
- Then go to the executor_map.json folder.
- In this folder you will see json pairs like key value pairs.
- The 'key' is the language name and 'value' is the string which is directly pasted in the powershell of vscode.
- So now you can easily modify the string to build your projects the way you want.
- For Example in the case of C++ , I can give a g++ command with a lot of different flags like -Wall -Wshadow etc.
- Code runner also auto detects the language you are working in. All you need to do is just press run, and your project will be build using your custom command.
- If there is some other easier way you can share that too.
