CS 115: Introduction to Computer Programming How to Use Visual Studio on Mac
Visual Studio is a Windows application and has limited functionally on Mac. Basically, what you are getting on Mac is a text editor combined with debugger and terminal (and some other tools). You will have to learn on your own how to use g++ compiler, gdb debugger, and how to execute a program from command line.
What is Visual Studio Code? Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS, and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).
Begin your journey with VS Code with these introductory videos.
1. Visual Studio Code Download page, it will automatically download the app: https://code.visualstudio.com/docs/?dv=osx
2. Open Visual Studio Code App (initially, it should be in your downloads)
3. Create/open new file
4. Write a C++ program and try to save it using “Save As” option Create a folder CS216 on your Desktop, and save all your programs there.
5. VS Code will ask you to install recommended extensions for C++. Install these extension.
6. Open Terminal in Visual Studio Widow using (Control ~)
7. Change directory using command by typing the following command: cd ~/Desktop/CS216/
8. To compile your code, use the following syntax: g++ -o [executable_name] [source_file(s).cpp] ex: g++ -o test test.cpp
9. Run your Program by typing the following command in the terminal window: ./[executable_name]
ex: ./test
10. You will see the output of your program in the terminal: