【发布时间】:2024-05-01 11:05:02
【问题描述】:
每当我尝试使用 IOStream 编译 C++ 文件时,我都会收到此错误。我尝试重新安装 GCC G++(4.6 和 4.9)和 cpp 。它没有帮助(或者我没有以正确的方式进行操作)。如何解决此错误
In file included from /usr/include/c++/4.9/bits/localefwd.h:40:0,
from /usr/include/c++/4.9/ios:41,
from /usr/include/c++/4.9/ostream:38,
from /usr/include/c++/4.9/iostream:39,
from Integration_Any.cpp:1:
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:23: error:‘uselocale’was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:45: error: invalid type in declaration before ‘;’ token
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’: /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
【问题讨论】:
-
向我们展示您的编译语句...!即
g++ x y z... -
mpic++ -o Int_Any Integration_Any.cpp -lm(使用 MPI 和数学头文件)
-
这绝对看起来您的安装有问题。您能否提供一些有关您正在使用的环境的详细信息?您能否尝试卸载并重新安装并描述您曾经执行此操作的命令?
-
尝试创建一个脚本 - 在您添加到
PATH前面的目录中将其命名为g++,当调用它时会打印出它的参数;然后运气好的话,您将能够看到mpic++实际编译的内容,您可以告诉我们.... -
mpic++ 或 g++ - 都给出相同的错误...
标签: c++ g++ ubuntu-12.04