Find answers, ask questions, and connect with our <br>community around the world.

Home Forums CPP scientific computing discussion Error while compiling the code in WSL Reply To: Error while compiling the code in WSL

  • Nishant

    Member
    August 18, 2022 at 2:09 pm

    Dear Naseer Abdul,

    Please first make sure that GNU gcc compiler is installed on your machine.
    1. Open the Ubuntu terminal
    2. Type the command, which gcc
    You should see the output /usr/bin/gcc
    If you get the same output, it means gcc compiler is installed on your machine.
    Otherwise, you can install gcc by running the command,
    sudo apt-get install gcc
    Once you have gcc installed please follow the steps below to compile and run the program.
    3. Make a Workspace folder at the following location,
    cd /mnt/d
    mkdir Workspace
    cd Workspace
    4. Create the HelloWorld.cpp in the Workspace folder
    5. Now compile using the command,
    g++ HelloWorld.cpp
    6. Execute the program by typing the following on the command line,
    ./a.out

    You will see the expected output on the terminal. Hope that helps.

error: Content is protected !!