How to Run C++ in VS Code on MacOS

preview_player
Показать описание
I will show you how to install C++ and how to run C++ in Visual Studio Code (#vscode). Running C++ programs in Visual Studio Code is an easy process once you have the required tools installed.

Timestamps:
0:00 - Introduction
0:30 - How to install C++ extension in visual studio code
0:50 - How to install Code Runner extension in visual studio code
1:10 - Install C++ compiler (clang)
2:30 - Creating a C++ program
2:50 - Running a C++ program in visual studio code

Found this video helpful and want to buy me a coffee?
Рекомендации по теме
Комментарии
Автор

men thanks realy, i comming to mac from windows and dont know how to close the program... you realy help me to continue learn c++ on mac.

Heisenberg-cfwg
Автор

ld: Undefined symbols: _main, referenced from: <initial-undefines> clang: error: linker command failed with exit code 1 (use -v to see invocation)

Chaitanya_Shedge
Автор

Super simple and helpful... just like it should be. Great job explaining!

makoakaleo
Автор

Why there's nothing in the "Output when my code run. Beside my code still showned in the terminal. Thank you

hoangvuong
Автор

This setup tutorial is so simple 😊
=> should hopefully get much more likes (and being pushed on youtube)
Thanks a lot for this very nice introduction !! 😉

frei-math-quantum
Автор

Hi bro. Got the problem : "The preLaunchTask 'C/C++: clang build active file' terminated with exit code -1.". Any idea how to solve? Thank you

coolbirdez
Автор

I installed both extensions like you said but when I click run, the search bar on top asks me to select a debug configuration. It was not as easy as just clicking run and debug. I had .vscode folder auto generate with tasks.json and launch.json where I had to change the command configuration from ""/usr/bin/clang" to ""/usr/bin/clang++" manually. I doubt code runner is doing what needs to be done. Any solutions to this pain point would be greatly appreciated.

When fixing all these issues and running, my "Hello world" comes in the debug console and not in the output console. VERY WEIRD and I am sure I have messed my VS code enough in the past years to encounter this problem.

aryamandarda
Автор

Please, make a guide, how to use custom libraries, I can't find out, how to do it on macOS((

folium
Автор

which c++ standard is applied to your g++ or clang by default? Mine is 199711 which is ancient. And I know I can pass in the flag to set it to a modern one with -std=c++20, but I wonder if I did anything wrong.

stonechen
Автор

so simple and well explained!! Thanks for share

antonioterron
Автор

Guys, how to fix "Errors exist after running preLaunchTask 'C/C++: clang ?

周琨淏
Автор

The preLaunchTask ‘C/C++: clang build active file’ terminated with exit code -1.

torpidfella
Автор

Hello
I've tried doing this but instead of showing my output "Hello World" I got "Activating task providers cppbuild" instead. Why?

tomriddle
Автор

It display 150 hours for standby time, after i wrote xcode-select --install. Is it normal???

Imparavitor
Автор

Anyone have clarification on the .run extension for me please?

I ask because I've been working on vscode for about a week now after starting a course to expand my c++ skills. The issue I've had is with the running of the code. I installed the c/c++ extension and that was it. The instruction didn't say anything else and I kept getting an error regarding the a.out file which I assume is the compiled executable or something like that.

I was on stack overflow when someone rudely told me to read the vs code manual and that I needed to set up prelaunch tasks. I was watching videos on prelaunch task setup when I realized that they all have different steps, missing steps, different versions, different OS etc.. I could never get the desired outcome.

Now, I come across this video and the only thing that's different is that I installed the .run extension. Runs code fine. However, the description says it runs "CODE SNIPPET". To me this sounds like its for small code files... maybe its just the chosen description, but I wonder if this completely takes care of the prelaunch requirements (with respect to JSON file) or do I still need to have that set up.

If I do need to set up the JSON configuration still, could someone please point me to an in-depth walkthrough to do this? I have a late 2017 MacBook Pro. Everything I've found implies I have strong working knowledge of VS, though I typically use basic editors when learning and have never used a program as complex as this for the task.

Sorry for the long post, and thanks in advance for any helpful comments or direction regarding this matter.

stevenhuff
Автор

big respect from russian boy! Thaaaanks

reddee
Автор

Why does this just work in "Hello World"?

Leon-zwrr
Автор

it still says command not found could u guide please?

duawahabkhan
Автор

I cannot type whenever I use "cin >>"

dragoongalaxy
Автор

Super simple and helpful... just like it should be. Great job explaining!

makoakaleo
join shbcf.ru