#44 missing cstdlib, cstring includes in Utils.cpp

closed-fixed
Psychon
Engine (43)
5
2014-10-30
2008-09-15
No

Building the latest znc release (0.060) with g++-4.3.1 on Debian fails with:

Utils.cpp: In static member function ‘static CString CUtils::GetIP(long unsigned int)’:
Utils.cpp:130: error: ‘memset’ was not declared in this scope
Utils.cpp: In static member function ‘static long unsigned int CUtils::GetLongIP(const CString&)’:
Utils.cpp:154: error: ‘atoi’ was not declared in this scope
Utils.cpp: In static member function ‘static CString CUtils::GetHashPass()’:
Utils.cpp:165: error: ‘strlen’ was not declared in this scope
Utils.cpp:165: error: ‘malloc’ was not declared in this scope
Utils.cpp:166: error: ‘strcpy’ was not declared in this scope
Utils.cpp:167: error: ‘memset’ was not declared in this scope
Utils.cpp:171: error: ‘strcmp’ was not declared in this scope
Utils.cpp:179: error: ‘free’ was not declared in this scope
Utils.cpp:186: error: ‘free’ was not declared in this scope
Utils.cpp: In static member function ‘static CString CUtils::GetSaltedHashPass(CString&)’:
Utils.cpp:199: error: ‘strlen’ was not declared in this scope
Utils.cpp:199: error: ‘malloc’ was not declared in this scope
Utils.cpp:201: error: ‘strcpy’ was not declared in this scope
Utils.cpp:203: error: ‘memset’ was not declared in this scope
Utils.cpp:207: error: ‘strcmp’ was not declared in this scope
Utils.cpp:222: error: ‘free’ was not declared in this scope
Utils.cpp:230: error: ‘free’ was not declared in this scope
Utils.cpp: In static member function ‘static bool CUtils::GetNumInput(const CString&, unsigned int&, unsigned int, unsigned int, unsigned int)’:
Utils.cpp:287: error: ‘atoi’ was not declared in this scope
Utils.cpp: In static member function ‘static bool CUtils::GetInput(const CString&, CString&, const CString&, const CString&)’:
Utils.cpp:307: error: ‘memset’ was not declared in this scope
Utils.cpp:311: error: ‘exit’ was not declared in this scope

Adding an #include <cstrlen> and an #include <cstdlib> in Utils.cpp fixes these errors.

Best regards

Discussion

  • Sebastian Ramacher

    The last line should read as: Adding an #include <cstring> and an #include <cstdlib> in Utils.cpp fixes
    these errors.

     
  • Psychon

    Psychon - 2008-09-16

    What happened that makes this fail now...? AFAIK no includes were removed.

    psychon

     
  • Psychon

    Psychon - 2008-09-16
    • assigned_to: prozacx --> psychon
     
  • Sebastian Ramacher

    Seems to be a problem with the standard library shipped with g++ 4.3. znc without the additional includes compiles fine with g++ 4.2.

    My g++ versions are:
    * gcc version 4.2.4 (Debian 4.2.4-3)
    * gcc version 4.3.1 (Debian 4.3.1-9)

     
  • Psychon

    Psychon - 2008-09-19

    Hm sorry, no one managed to reproduce this. (At least one tried with vanilla gcc 4.3 and one with Debian's 4.3.1-9)

    Any ideas what might be going on?

     
  • Sebastian Ramacher

    You should be able to reproduce it if you run configure with --disable-openssl. I've installed the openssl development package today an reconfigured it and znc compiled fine.
    So I'd recommend adding the includes nevertheless.

     
  • Psychon

    Psychon - 2008-09-21

    Fixed in r1212 and sorry for my slowness.
    Thanks for reporting this :)

     
  • Psychon

    Psychon - 2008-09-21
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks