×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

那位遇到过这种问题:AIX上gcc编译器对函数复用报错,而且曲解了.h文件中的函数定义.

本文发表在 rolia.net 枫下论坛bash-3.00# /usr/local/bin/g++ -Wall -O2 -D_UNIX -D_POSIX -DAIX -I/usr/local/include -I/usr/include -I/usr/local/include -I/usr/local/unixODBC/include -I/root/hiplinkxs/src/hllib/include -I/root/hiplinkxs/src/hldblib/include -I/root/hiplinkxs/src/hldblib/rdb/include -I/root/hiplinkxs/src/hldblib/sdb/include -I/root/hiplinkxs/src/hldblib/rdb/odbc/include -c ../rdb/src/HLRDBschedulableGroup.cpp
../rdb/src/HLRDBschedulableGroup.cpp: In member function 'virtual long unsigned int HLRDBschedulableGroup::AddSchedule(HL_ONDUTY_SCHEDULE*)':
../rdb/src/HLRDBschedulableGroup.cpp:726: error: call of overloaded 'HLstringSQLEncode(long int&)' is ambiguous
/root/hiplinkxs/src/hllib/include/HLlibShare.h:125: note: candidates are: std::string HLstringSQLEncode(const std::string&) <near match>
/root/hiplinkxs/src/hllib/include/HLlibShare.h:156: note: std::string HLstringSQLEncode(time_t)
/root/hiplinkxs/src/hllib/include/HLlibShare.h:135: note: std::string HLstringSQLEncode(float)
/root/hiplinkxs/src/hllib/include/HLlibShare.h:140: note: std::string HLstringSQLEncode(double)
/root/hiplinkxs/src/hllib/include/HLlibShare.h:145: note: std::string HLstringSQLEncode(unsigned int)
/root/hiplinkxs/src/hllib/include/HLlibShare.h:150: note: std::string HLstringSQLEncode(long unsigned int)

在文件/root/hiplinkxs/src/hllib/include/HLlibShare.h的150行,实际函数定义是这样的:
std::string HLstringSQLEncode(unsigned long data);

我是C++加AIX双料菜鸟,虚心求教.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / 那位遇到过这种问题:AIX上gcc编译器对函数复用报错,而且曲解了.h文件中的函数定义.
    本文发表在 rolia.net 枫下论坛bash-3.00# /usr/local/bin/g++ -Wall -O2 -D_UNIX -D_POSIX -DAIX -I/usr/local/include -I/usr/include -I/usr/local/include -I/usr/local/unixODBC/include -I/root/hiplinkxs/src/hllib/include -I/root/hiplinkxs/src/hldblib/include -I/root/hiplinkxs/src/hldblib/rdb/include -I/root/hiplinkxs/src/hldblib/sdb/include -I/root/hiplinkxs/src/hldblib/rdb/odbc/include -c ../rdb/src/HLRDBschedulableGroup.cpp
    ../rdb/src/HLRDBschedulableGroup.cpp: In member function 'virtual long unsigned int HLRDBschedulableGroup::AddSchedule(HL_ONDUTY_SCHEDULE*)':
    ../rdb/src/HLRDBschedulableGroup.cpp:726: error: call of overloaded 'HLstringSQLEncode(long int&)' is ambiguous
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:125: note: candidates are: std::string HLstringSQLEncode(const std::string&) <near match>
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:156: note: std::string HLstringSQLEncode(time_t)
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:135: note: std::string HLstringSQLEncode(float)
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:140: note: std::string HLstringSQLEncode(double)
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:145: note: std::string HLstringSQLEncode(unsigned int)
    /root/hiplinkxs/src/hllib/include/HLlibShare.h:150: note: std::string HLstringSQLEncode(long unsigned int)

    在文件/root/hiplinkxs/src/hllib/include/HLlibShare.h的150行,实际函数定义是这样的:
    std::string HLstringSQLEncode(unsigned long data);

    我是C++加AIX双料菜鸟,虚心求教.更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • ../rdb/src/HLRDBschedulableGroup.cpp中726行调用是HLstringSQLEncode( schedule->tScd.tWeekly.lDays ),参数是long类型.
      • 调用的时候强制转换成unsigned long 试试。HLstringSQLEncode( (unsigned long)(schedule->tScd.tWeekly.lDays) );
        • 函数原型中缺少一个std::string HLstringSQLEncode(long)定义.加上后就可以了. 多谢.