我意外删除了位于 /usr/include/c++ 中的所有 C++ 头文件的文件夹。我该怎么做才能恢复
更新我确实在 /usr/include/c++ 中恢复了头文件。但是,即使是一个简单的 C++ Hello World 程序也会出现此错误
In file included from /usr/include/c++/4.6/bits/localefwd.h:42:0,
from /usr/include/c++/4.6/ios:42,
from /usr/include/c++/4.6/ostream:40,
from /usr/include/c++/4.6/iostream:40,
from Hello.cpp:1:
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h:53:23: error: ‘uselocale’ was not declared in this scope
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h:53:45: error: invalid type in declaration before ‘;’ token
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h:76:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h:101:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
答案1
您可以使用以下命令获取已安装文件到 /usr/include/c++ 的软件包的逗号分隔列表
dpkg --search /usr/include/c++
然后对每个列出的包运行
sudo apt-get install --reinstall
答案2
尝试重新安装 g++
sudo apt-get install --reinstall g++