无法编译任何 C++ 代码

Pra*_*dra 6 c++ g++ ubuntu-12.04

每当我尝试使用 IOStream 编译 C++ 文件时,我都会收到此错误。我尝试重新安装 GCC G++ (4.6 和 4.9)和 cpp ..它没有帮助(或者也许我没有以正确的方式执行此操作)。我该如何修复这个错误

\n\n
In file included from /usr/include/c++/4.9/bits/localefwd.h:40:0,\n             from /usr/include/c++/4.9/ios:41,\n             from /usr/include/c++/4.9/ostream:38,\n             from /usr/include/c++/4.9/iostream:39,\n             from Integration_Any.cpp:1:\n/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:23: error:\xe2\x80\x98uselocale\xe2\x80\x99was         not declared in this scope\n   extern "C" __typeof(uselocale) __uselocale;\n                   ^\n/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:45: error: invalid type in    declaration before \xe2\x80\x98;\xe2\x80\x99 token\n   extern "C" __typeof(uselocale) __uselocale;\n                                         ^\n/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h: In function \xe2\x80\x98int     std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)\xe2\x80\x99:       /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:75:53: error:     \xe2\x80\x98__gnu_cxx::__uselocale\xe2\x80\x99 cannot be used as a function\n     __c_locale __old = __gnu_cxx::__uselocale(__cloc);\n                                                 ^\n/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:100:33: error:     \xe2\x80\x98__gnu_cxx::__uselocale\xe2\x80\x99 cannot be used as a function\n     __gnu_cxx::__uselocale(__old);\n                             ^\n
Run Code Online (Sandbox Code Playgroud)\n

小智 0

我使用 openmpi 和更新版本的 g++ 看到了同样的错误。您可能正在使用用另一个 C++ 编译器编译的 mpi 安装。比较 mpicxx -v 和 g++ -v 的输出。我猜 mpicxx -v 将显示比您拥有的旧的 g++ 版本,并使用您正在使用的较新的 g++ 版本重新安装您的 mpi。