-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3325c53
commit 045f359
Showing
13 changed files
with
699 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,66 @@ | ||
--- | ||
title: Visual Studio Code | ||
description : "" | ||
description: "" | ||
sidebar_position: 1 | ||
--- | ||
## 🚧 Work in Progress ! | ||
|
||
# How to Download and setup vs code ? | ||
|
||
|
||
## Table of Contents | ||
|
||
- [How to Download and setup vs code ?](#how-to-download-and-setup-vs-code-) | ||
- [Table of Contents](#table-of-contents) | ||
- [Download and Install](#download-and-install) | ||
- [Add to PATH (Optional)](#add-to-path-optional) | ||
- [Launch Visual Studio Code](#launch-visual-studio-code) | ||
- [Additional Resources](#additional-resources) | ||
|
||
--- | ||
|
||
## Download and Install | ||
|
||
1. **Download Visual Studio Code:** | ||
|
||
- Visit the official [Visual Studio Code Download Page](https://code.visualstudio.com/Download). | ||
- Select your operating system (Windows, macOS, or Linux) to download the appropriate installer. | ||
|
||
2. **Install Visual Studio Code:** | ||
- **Windows:** Run the downloaded `.exe` file and follow the setup wizard. | ||
- **macOS:** Open the downloaded `.zip` file and drag the **Visual Studio Code** app to the `Applications` folder. | ||
- **Linux:** | ||
- For **Debian/Ubuntu**: | ||
```bash | ||
sudo apt update | ||
sudo apt install software-properties-common apt-transport-https wget | ||
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - | ||
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | ||
sudo apt update | ||
sudo apt install code | ||
``` | ||
|
||
## Add to PATH (Optional) | ||
|
||
- **Windows:** During installation, you can select the option to add Visual Studio Code to your system's `PATH`. | ||
- **macOS:** | ||
- Open Visual Studio Code. | ||
- Press `Cmd+Shift+P` to open the Command Palette. | ||
- Type `shell command` and select **Install 'code' command in PATH**. | ||
- **Linux:** If not added automatically, you can add Visual Studio Code to the `PATH` using your shell's configuration file. | ||
|
||
## Launch Visual Studio Code | ||
|
||
- **Windows/macOS/Linux:** After installation, you can launch Visual Studio Code: | ||
- From the Start menu (Windows), `Applications` folder (macOS), or application menu (Linux). | ||
- Or, open the terminal and type: | ||
```bash | ||
code | ||
``` | ||
|
||
## Additional Resources | ||
|
||
- **Extensions Marketplace:** Enhance your coding experience by exploring the [VS Code Extensions Marketplace](https://marketplace.visualstudio.com/vscode). | ||
- **Documentation:** Check out the official [VS Code Documentation](https://code.visualstudio.com/docs) for more in-depth tutorials and guides. | ||
- **Community Support:** Join the [Visual Studio Code Community](https://code.visualstudio.com/community) to connect with other developers. | ||
|
||
**<center><i>Thanks for Visiting!</i>😊</center>** |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,220 +1,112 @@ | ||
--- | ||
title: C++ | ||
title: C/C++ | ||
--- | ||
|
||
import Extension from '../../../static/Images/Extension.png'; | ||
import Select_c_option from '../../../static/Images/Select_C_option.png' | ||
# Programming With C++ | ||
|
||
## Installing C++ on Windows | ||
This guide provides step-by-step instructions to install C++ on **Windows**, **Linux**, and **macOS**. | ||
|
||
Follow these steps to install C++ on your Windows system: | ||
## Windows Installation | ||
|
||
**1. Download Visual Studio Code** | ||
:::note | ||
:::tip | ||
[Download and Install Visual Studio Code](/docs/Code_Editors/vs_code/VS_Code.md). | ||
::: | ||
|
||
- If you already have visual studio code in your Operating System then ignore this step. | ||
::: | ||
- **Visit the Website**: Go to [Visual Studio Code](https://code.visualstudio.com/Download). | ||
- **Download**: Click on the "Download for Windows" button to get the installer. | ||
### 1. Install C++ Extension in VS Code | ||
|
||
**2. Install Visual Studio Code** | ||
- Open VS Code and Go to **Extensions** (`Ctrl + Shift + X`). | ||
- Search for **" C/C++"** by Microsoft and click **Install**. | ||
|
||
- **Run the Installer**: Open the downloaded `.exe` file and follow the on-screen instructions. | ||
- **Customize Installation**: You can use the default settings or customize them if needed. | ||
- **Finish**: Click "Install" and wait for the installation to complete, then click "Finish." | ||
### 2. Install MinGW | ||
|
||
**3. Install the C++ Extension in VS Code (Common For all Operating Systems)** | ||
- Go to the [MinGW-w64 website](https://sourceforge.net/projects/mingw-w64/) and download the installer. | ||
- Run the installer, choose the default settings, and complete the installation. | ||
|
||
- **Open VS Code**: Launch Visual Studio Code. | ||
- **Go to Extensions**: Click on the Extensions icon on the left sidebar or press `Ctrl + Shift + X`. | ||
- **Search for C++**: Type "C++" in the search box and look for the "C/C++" extension by Microsoft. | ||
- **Install**: Click "Install" to add the extension to Visual Studio Code. | ||
### 3. Add MinGW to PATH | ||
|
||
<img src={Extension} alt="First_step" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "800px"}}/> | ||
- Right-click on "This PC" or "Computer" on your desktop and select **Properties**. | ||
- Click **Advanced system settings**, then **Environment Variables**. | ||
- In "System variables", select "Path" and click **Edit**. | ||
- Add `C:\MinGW\bin` to the list and click **OK**. | ||
|
||
**4. Install MinGW (Minimalist GNU for Windows)** | ||
### 4. Verify Installation | ||
|
||
- **Download MinGW**: Go to the [MinGW-w64 website](https://sourceforge.net/projects/mingw-w64/) and download the installer. | ||
- **Run the Installer**: Launch the installer and follow the setup instructions. | ||
- **Select Architecture**: Choose the appropriate architecture (e.g., x86_64 for 64-bit). | ||
- **Installation Directory**: Select the installation directory (default is usually fine) and `Installation ⇨ Apply Changes`. | ||
<img src={Select_c_option} alt="First_step" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "800px", margin:"5px 0 0 0 "}}/> | ||
- **Complete Installation**: Finish the installation process. | ||
- Open Command Prompt (`Win + R`, type `cmd`, press Enter). | ||
- Type `gcc --version` and press Enter to check the installation. | ||
|
||
**5. Add MinGW to System PATH** | ||
|
||
- **Open System Properties**: Right-click on "This PC" or "Computer" on your desktop and select "Properties." | ||
- **Advanced System Settings**: Click on "Advanced system settings" on the left sidebar. | ||
- **Environment Variables**: Click the "Environment Variables" button. | ||
- **Edit Path**: Under "System variables," find the "Path" variable, select it, and click "Edit." | ||
- **Add New Path**: Click "New" and add the path to the `bin` directory of your MinGW installation (e.g., `C:\MinGW\bin`). | ||
- **Save Changes**: Click "OK" to save your changes and close all windows. | ||
|
||
**6. Verify Installation** | ||
|
||
- **Open Command Prompt**: Press `Win + R`, type `cmd`, and press `Enter`. | ||
- **Check GCC Version**: Type `gcc --version` and press `Enter`. If installed correctly, it should display the GCC version information. | ||
|
||
**7. Write Your First C++ Program** | ||
|
||
- **Create a New File**: In VS Code, go to `File > New File` and save it with a `.cpp` extension (e.g., `hello.cpp`). | ||
- **Write Code**: Type a simple C++ program: | ||
|
||
```cpp | ||
#include <iostream> | ||
int main() { | ||
std::cout << "Hello, World!" << std::endl; | ||
return 0; | ||
} | ||
``` | ||
## Installing C++ on Linux & Ubuntu | ||
--- | ||
|
||
Follow these steps to install C++ on your Linux or Ubuntu system: | ||
## Linux Installation | ||
|
||
#### **1. Update the Package List** | ||
### 1. Update System packages | ||
|
||
- **Open Terminal**: Press `Ctrl + Alt + T` to open the terminal. | ||
- **Update Packages**: Run the following command to update the package list: | ||
- **Open Terminal** (Press `Ctrl + Alt + T`). | ||
- Update system packages: | ||
|
||
```bash | ||
```bash | ||
sudo apt-get update | ||
``` | ||
|
||
**2. Install the Build-Essential Package** | ||
|
||
- **Install Build-Essential**: This package contains the essential tools for compiling software, including GCC (GNU Compiler Collection) and G++ (the C++ compiler): | ||
|
||
```bash | ||
sudo apt-get install build-essential | ||
``` | ||
|
||
- **Verify Installation**: After installation, you can verify the installation of GCC by running: | ||
|
||
```bash | ||
gcc --version | ||
``` | ||
|
||
This should display the GCC version installed on your system. | ||
|
||
**3. Install Additional Libraries (Optional)** | ||
``` | ||
|
||
- **Standard C++ Library**: You can install the Standard C++ Library by running | ||
### 2. Install C++ Tools | ||
|
||
```bash | ||
sudo apt-get install libstdc++6 | ||
``` | ||
- Install the necessary tools with : | ||
|
||
- **Additional Libraries**: If you need additional libraries, you can install them using the apt-get install command. | ||
```bash | ||
# This command installs essential build tools like gcc and g++ for compiling C++ programs. | ||
sudo apt-get install build-essential | ||
``` | ||
|
||
**4. Write Your First C++ Program** | ||
### 3. Write and Run a simple Program | ||
|
||
- **Create a New File**: Use a text editor like nano, vim, or gedit to create a new file with a `.cpp` extension: | ||
- create a file `(e.g. example.cpp )` and Add this code. | ||
|
||
```bash | ||
nano hello.cpp | ||
``` | ||
```cpp | ||
#include <iostream> | ||
|
||
- **Write Code**: Type a simple C++ program: | ||
```cpp | ||
#include <iostream> | ||
int main() { | ||
std::cout << "Hello, World!" << std::endl; | ||
return 0; | ||
} | ||
``` | ||
- **Save the File**: Save the file and exit the editor. | ||
int main() { | ||
std::cout << "Hello, World!" << std::endl; | ||
return 0; | ||
} | ||
|
||
**5. Compile Your C++ Program** | ||
``` | ||
|
||
- **Compile the Program:** Use the G++ compiler to compile your C++ program: | ||
- Compile and run the program. | ||
|
||
```bash | ||
g++ hello.cpp -o hello | ||
``` | ||
```bash | ||
g++ example.cpp -o example | ||
./hello | ||
``` | ||
|
||
- **Run the Program:** Execute the compiled program: | ||
```bash | ||
./hello | ||
``` | ||
- You should see the output: | ||
|
||
```bash | ||
Hello, World! | ||
``` | ||
|
||
## Installing C++ on macOS | ||
--- | ||
|
||
Follow these steps to install C++ on your macOS system: | ||
## macOS Installation | ||
|
||
**1. Install Homebrew** | ||
### 1. Install Homebrew | ||
|
||
- **Open Terminal**: Press `Cmd + Space`, type `Terminal`, and press `Enter`. | ||
- **Install Homebrew**: Homebrew is a package manager for macOS. To install it, paste the following command in Terminal and press `Enter`: | ||
- **Open Terminal** (Press `Cmd + Space`, type `Terminal`, and press Enter). | ||
- Install Homebrew (a package manager for macOS) if it's not already installed: | ||
|
||
```bash | ||
```bash | ||
# Note: You might need to provide your administrator password during this process. | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
``` | ||
|
||
**2. Install GCC (GNU Compiler Collection)** | ||
|
||
- Install GCC: Once Homebrew is installed, use it to install GCC by running the following command in Terminal: | ||
|
||
```bash | ||
brew install gcc | ||
``` | ||
|
||
**3. Install Visual Studio Code** | ||
:::note | ||
``` | ||
|
||
- If you already have visual studio code in your Operating System then ignore this step. | ||
::: | ||
### 2. Install GCC | ||
|
||
- **Download VS Code:** Visit the [Visual Studio Code](https://code.visualstudio.com/Download) website. | ||
- **Download for macOS:** Click on the "Download for macOS" button to get the installer. | ||
- **Install:** Open the downloaded .zip file, move Visual Studio Code to the Applications folder, and launch it. | ||
- In Terminal, type the following command to install the GCC compiler : | ||
|
||
**4. Install the C++ Extension in VS Code** | ||
```bash | ||
brew install gcc | ||
``` | ||
|
||
- **Open VS Code:** Launch Visual Studio Code. | ||
- **Go to Extensions:** Click on the Extensions icon on the left sidebar or press Cmd + Shift + X. | ||
- **Search for C++:** Type "C++" in the search box and look for the "C/C++" extension by Microsoft. | ||
- **Install:** Click "Install" to add the extension to Visual Studio Code. | ||
### 3. Verify GCC Installation | ||
|
||
**5. Set Up the Environment** | ||
```bash | ||
g++ --version | ||
``` | ||
|
||
- **Link GCC:** On macOS, you may need to create a symlink to make g++ point to the Homebrew-installed version of GCC. Run: | ||
|
||
```bash | ||
sudo ln -s /usr/local/bin/g++-<version> /usr/local/bin/g++ | ||
``` | ||
|
||
- Replace < version > with the GCC version installed (e.g., `12` for `g++-12`) | ||
|
||
**6. Verify Installation** | ||
|
||
- **Check GCC Version:** Open Terminal and type: | ||
```bash | ||
g++ --version | ||
``` | ||
- This should display the version of GCC installed. | ||
|
||
**7. Write Your First C++ Program** | ||
|
||
- **Create a New File:** In VS Code, go to File > New File and save it with a .cpp extension (e.g., hello.cpp). | ||
- **Write Code:** Type a simple C++ program: | ||
--- | ||
|
||
```cpp | ||
#include <iostream> | ||
int main() { | ||
std::cout << "Hello, World!" << std::endl; | ||
return 0; | ||
} | ||
``` | ||
**Note:** These steps should ensure C++ is installed and ready to use on your system. | ||
|
||
- **Compile and Run:** In the Terminal within VS Code or your macOS Terminal, navigate to the directory where your file is saved and run: | ||
```bash | ||
g++ -o hello hello.cpp | ||
./hello | ||
``` | ||
- This will compile your code and run the resulting program, printing "Hello, World!" to the Terminal. | ||
<center><i>Thank you for visiting!</i></center> |
Oops, something went wrong.