skip to Main Content

I can’t install C++ extension for Visual studio code. When I try to install it I get message of error:

Error while installing 'C/C++' extension. Please check the log for more details.

And when I checked logs to had seen next message:

2023-06-29 14:03:55.273 [error] Download: net::ERR_NETWORK_CHANGED
    at gt.download (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:81:160122)
    at async j.y (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:82:20937)
    at async j.h (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:82:19006)
2023-06-29 14:03:55.310 [error] net::ERR_NETWORK_CHANGED: Download: net::ERR_NETWORK_CHANGED
    at gt.download (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:81:160122)
    at async j.y (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:82:20937)
    at async j.h (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:82:19006)

My OS is Ubuntu 22.04.

How can I install C++ extension?

I tried reinstalling VS Code but it didn’t work.

2

Answers


  1. Ensure GCC is installed

    Although you’ll use VS Code to edit your source code, you’ll compile the source code on Linux using the g++ compiler. You’ll also use GDB to debug. These tools are not installed by default on Ubuntu, so you have to install them. Fortunately, that’s easy.

    First, check to see whether GCC is already installed. To verify whether it is, open a Terminal window and enter the following command:

    gcc -v
    

    I have the same OS (Ubuntu 22.04). I just check out, and I have installed the C++ extension for VS Code. Furthermore, I ran a simple helloworld.cpp, and I have the following:

    #include <iostream>
    #include <vector>
    #include <string>
    
    using namespace std;
    
    int main()
    {
        vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
        for (const string& word : msg)
        {
            cout << word << " ";
        }
        cout << endl;
    }
    

    And the log

    [Running] cd "/home/piercel/cplusplus/projects/helloworld/" && g++ helloworld.cpp -o helloworld && "/home/piercel/cplusplus/projects/helloworld/"helloworld
    Hello C++ World from VS Code and the C++ extension! 
    
    [Done] exited with code=0 in 1.584 seconds
    
    Login or Signup to reply.
  2. Try seeing if you have gcc installed using the terminal gcc –version

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search