Skip to content

Commit

Permalink
Added C++ Installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeetsuthar committed Aug 17, 2024
1 parent e0d5582 commit c4c670c
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 11 deletions.
218 changes: 217 additions & 1 deletion docs/Programming/CPlusPlus/CPlusPlus.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,220 @@
---
title: C++
---
## 🚧 Work in Progress !

import Extension from '../../../static/Images/Extension.png';
import Select_c_option from '../../../static/Images/Select_C_option.png'

## Installing C++ on Windows

Follow these steps to install C++ on your Windows system:

**1. Download Visual Studio Code**
:::note

- 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.

**2. Install Visual Studio Code**

- **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."

**3. Install the C++ Extension in VS Code (Common For all Operating Systems)**

- **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.

<img src={Extension} alt="First_step" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "800px"}}/>

**4. Install MinGW (Minimalist GNU for Windows)**

- **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.

**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:
#### **1. Update the Package List**
- **Open Terminal**: Press `Ctrl + Alt + T` to open the terminal.
- **Update Packages**: Run the following command to update the package list:
```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

```bash
sudo apt-get install libstdc++6
```

- **Additional Libraries**: If you need additional libraries, you can install them using the apt-get install command.

**4. Write Your First C++ Program**

- **Create a New File**: Use a text editor like nano, vim, or gedit to create a new file with a `.cpp` extension:

```bash
nano hello.cpp
```

- **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.
**5. Compile Your C++ Program**
- **Compile the Program:** Use the G++ compiler to compile your C++ program:
```bash
g++ hello.cpp -o 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:

**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`:

```bash
/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.
:::

- **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.

**4. Install the C++ Extension in VS Code**

- **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.

**5. Set Up the Environment**

- **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;
}
```
- **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.
20 changes: 10 additions & 10 deletions docs/Programming/python/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Make sure to check both the checkboxes:
- Add python.exe to PATH : Make sure to check the option to **Add Python to PATH** if available. This makes it easier to use Python from the command line.

After that click on the `Customize installation` to proceed.
<img src={First} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={First} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

#### ensure you check the following options (In Optional Features)

Expand All @@ -46,7 +46,7 @@ After that click on the `Customize installation` to proceed.
- Ensure the option for all users (requires admin privileges) is checked.

After selecting the options, click on the `Next button` to proceed.
<img src={Second} alt="Second_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={Second} alt="Second_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

The following options are available under Advanced Options. Some are automatically selected, and some need to be manually checked:

Expand All @@ -60,13 +60,13 @@ If any of the options shown in the image below are not checked in your operating
:::

After selecting the options, click on the `Install button` to proceed.
<img src={Third} alt="Third_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={Third} alt="Third_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

After the installation, you will see a page displaying `Setup was successful`. Click on the `Close button`.

**congratulations** 👏 — you have successfully installed Python on your operating system.

<img src={Fourth} alt="Fourth_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={Fourth} alt="Fourth_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

**Step 4** : Open a command prompt (Windows) and type and paste

Expand Down Expand Up @@ -172,22 +172,22 @@ import six from '../../../static/Images/Python/6.png';

- Double-click the downloaded `.pkg` file to start the installation process.
- You will see a pop-up window. Click `Continue` to proceed.
<img src={one} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={one} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

- If you want to read the license terms and conditions, please do so. Otherwise, scroll down and click the `Continue` button.
<img src={two} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={two} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

- Read everything, then click the `Continue` button.
<img src={three} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={three} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

- Read everything, then click the `Continue` button.
<img src={four} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={four} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

- Agree to all the terms and conditions, then click the `Agree` button.
<img src={five} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={five} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

- Now we are at the final stage of the installation. Click the `Install` button
<img src={six} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "600px"}}/>
<img src={six} alt="First_step" width="600" height="400" style={{border: "2px solid", padding: "5px", borderRadius: "5px", width: "100%", height: "auto", maxWidth: "700px"}}/>

**Step 4 : Verify Installation**

Expand Down
Binary file added static/Images/Extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/Images/MinGW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/Images/Select_C_option.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c4c670c

Please sign in to comment.