#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    178
    Rep Power
    27

    g++ not recognizing functions


    Hello,
    I'm trying to compile source code for an application i downloaded
    (gdb 5.3).
    I am using the g++ 3.2.1 compiler.
    For some reason, it stumbles on function declarations that
    look like this:

    void
    set_cplus_marker_for_demangling (ch)
    int ch;

    It says:
    cplus-dem.c:93: `ch' was not declared in this scope
    cplus-dem.c:94: variable or field `set_cplus_marker_for_demangling' declared
    void
    cplus-dem.c:94: `int set_cplus_marker_for_demangling' redeclared as different
    kind of symbol
    ../include/demangle.h:120: previous declaration of `void
    set_cplus_marker_for_demangling(int)'

    I.e. it expects the declaration to be
    "void set_cplus_marker_for_demangling (int ch)".

    How do I force it to recognize that kind of declaration? Obviously
    the authors of gdb were able to compile their code somehow, so
    I'm guessing that I'm missing some comiler option. Does anyone have any idea?
    Thanks in advance.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243

    You have old style C code


    The function declaration is old style Kernighan and Ritchie and probably is no longer supported by your compiler's default configuration. I expect there is a switch you can set, check your man pages and look up "Kernighan and Ritchie" or "K&R"

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo