Skip to content
This repository was archived by the owner on Jul 11, 2018. It is now read-only.
This repository was archived by the owner on Jul 11, 2018. It is now read-only.

TFS在ubuntu gcc4.8下编译出错 #27

Description

@RupengWang
block_collect.cpp:229:17: error: ‘abs’ is not a member of ‘__gnu_cxx’
             if (__gnu_cxx::abs(info_.version_ - info.version_) <= VERSION_AGREED_MASK)//version agreed
                 ^
block_collect.cpp:229:17: note: suggested alternatives:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from block_collect.cpp:16:
/usr/include/stdlib.h:775:12: note:   ‘abs’
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from block_collect.cpp:16:
/usr/include/c++/4.8/cstdlib:179:3: note:   ‘std::abs’
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }

试过如果把'__gnu_cxx' 替换为'std' 还是无法编译通过 ,错误如下

client_request_server.cpp: In member function ‘int tfs::nameserver::ClientRequestServer::batch_open(const VUINT32&, int32_t, int32_t, std::map<unsigned int, tfs::common::BlockInfoSeg>&)’:
client_request_server.cpp:160:56: error: call of overloaded ‘abs(std::map<unsigned int, tfs::common::BlockInfoSeg>::size_type)’ is ambiguous
           stat[1] = std::abs(out.size() - blocks.size());
                                                        ^
client_request_server.cpp:160:56: note: candidates are:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/stdlib.h:775:12: note: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/c++/4.8/cstdlib:166:3: note: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/4.8/cstdlib:174:3: note: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/4.8/cstdlib:179:3: note: __int128 std::abs(__int128)
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
   ^
client_request_server.cpp:167:54: error: call of overloaded ‘abs(std::map<unsigned int, tfs::common::BlockInfoSeg>::size_type)’ is ambiguous
           stat[3] = std::abs(out.size() - block_count);
                                                      ^
client_request_server.cpp:167:54: note: candidates are:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/stdlib.h:775:12: note: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/c++/4.8/cstdlib:166:3: note: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/4.8/cstdlib:174:3: note: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/4.8/cstdlib:179:3: note: __int128 std::abs(__int128)
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions