我无法安装Visual Studio代码的C++扩展

70gysomp  于 2023-07-01  发布在  其他
关注(0)|答案(2)|浏览(214)

我无法安装Visual Studio代码的C++扩展。当我尝试安装它时,我收到错误消息:

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

当我检查日志时,看到了下一条消息:

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)

操作系统是Ubuntu 22.04。
如何安装C++扩展?
我尝试重新安装VS Code,但它不起作用。
P.S.我有GCC 11.3.0。

toiithl6

toiithl61#

确保已安装GCC
虽然您将使用VS Code来编辑源代码,但您将使用g++编译器在Linux上编译源代码。您还将使用GDB进行调试。这些工具默认情况下不会安装在Ubuntu上,因此您必须安装它们。幸运的是,这很容易。
首先,检查是否已经安装了GCC。若要验证是否为,请打开“终端”窗口并输入以下命令:

gcc -v

操作系统:Ubuntu 22.04我刚刚 checkout ,我已经安装了VS代码的C++扩展。此外,我运行了一个简单的helloworld.cpp,我有以下内容:

#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;
}

还有木头

[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
5gfr0r5j

5gfr0r5j2#

尝试使用终端gcc --version查看是否安装了gcc

相关问题