Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ GCC cmath编译类型冲突_C++_G++_Cmath - Fatal编程技术网

C++ GCC cmath编译类型冲突

C++ GCC cmath编译类型冲突,c++,g++,cmath,C++,G++,Cmath,我正试图用我的笔记本电脑(MacOS10.8)编译ns2.34。在解决了几个问题之后,现在我遇到了这个问题: In file included from /opt/local/include/gcc48/c++/complex:44:0, from /opt/local/include/boost/type_traits/is_complex.hpp:12, from /opt/local/include/boost/type_traits.h

我正试图用我的笔记本电脑(MacOS10.8)编译ns2.34。在解决了几个问题之后,现在我遇到了这个问题:

In file included from /opt/local/include/gcc48/c++/complex:44:0,
             from /opt/local/include/boost/type_traits/is_complex.hpp:12,
             from /opt/local/include/boost/type_traits.hpp:49,
             from /opt/local/include/boost/pending/property.hpp:13,
             from /opt/local/include/boost/graph/graph_traits.hpp:27,
             from ./more_leastCost/leastcost.h:16,
             from ./mobile/god.h:57,
             from gaf/gaf.cc:53:
/opt/local/include/gcc48/c++/cmath:99:16: error: 'template<class _Tp> typename
 __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp)'
 conflicts with previous using declaration 'template<class Type> Type abs(Type)'
 abs(_Tp __x)
            ^
make: *** [gaf/gaf.o] Error 1
在/opt/local/include/gcc48/c++/complex:44:0中包含的文件中,
来自/opt/local/include/boost/type_traits/is_complex.hpp:12,
来自/opt/local/include/boost/type_traits。hpp:49,
从/opt/local/include/boost/pending/property.hpp:13,
从/opt/local/include/boost/graph/graph_traits.hpp:27,
自./more_leastCost/leastCost.h:16,
from./mobile/god.h:57,
摘自gaf/gaf.cc:53:
/opt/local/include/gcc48/c++/cmath:99:16:错误:“模板类型名”
__gnu_cxx:::_启用_如果::_类型std::abs(_Tp)'
与以前使用的声明“模板类型abs(类型)”冲突
防抱死制动系统
^
make:**[gaf/gaf.o]错误1

在我看来,这个错误是由GCC内部的冲突造成的?以前有人遇到过此问题吗?

您能显示导致此错误的代码吗?理想情况下,您可以将其缩小到一个小型的自包含示例吗?声明
abs(Type)
并非来自gcc。您可以预处理文件(
-E
)并查找该声明。还可以使用指令查找相关的
某个地方,并且存在
blah::abs()
。请注意,Boost有自己的
abs
,我打赌这就是冲突所在。名称空间的存在是为了避免这种冲突,这就是为什么
使用名称空间语句被广泛地劝阻。我想这就是原因!我会努力找到答案的!