AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
Expand all | Collapse all

1540-0274 (S) The name lookup for "getprocs" did not find a declaration

  • 1.  1540-0274 (S) The name lookup for "getprocs" did not find a declaration

    Posted Thu April 23, 2009 03:49 AM

    Originally posted by: SystemAdmin


    AIX 5.3

    IBM XL C/C++ Enterprise Edition V8.0 for AIX
    Version: 08.00.0000.0014
    From man getprocs

    Technical Reference: Base Operating System and Extensions, Volume 1

    getprocs Subroutine

    Purpose

    Gets process table entries.

    Library

    Standard C library (libc.a)

    Syntax

    #include <procinfo.h>
    #include <sys/types.h>

    int

    getprocs ( ProcessBuffer, ProcessSize, FileBuffer, FileSize, IndexPointer, Count)
    ..............
    int

    getprocs64 ( ProcessBuffer, ProcessSize, FileBuffer, FileSize, IndexPointer, Count)
    .................



    • bar.cpp ----

    #include <procinfo.h>
    #include <sys/types.h>
    int main()
    {
    struct procsinfo pinfo;
    pid_t retval = (pid_t)0;
    getprocs(&pinfo, sizeof(struct procsinfo), 0, 0, &retval, 1);
    getprocs64(&pinfo, sizeof(struct procsinfo), 0, 0, &retval, 1);
    return 0;
    }


    Compilation
    > xlC_r -q64 bar.cpp
    "bar.cpp", line 7.9: 1540-0274 (S) The name lookup for "getprocs" did not find a declaration.
    "bar.cpp", line 8.9: 1540-0274 (S) The name lookup for "getprocs64" did not find a declaration.
    What is wrong?

    Thanks.

    Alex Vinokur
    #AIX-Forum


  • 2.  Re: 1540-0274 (S) The name lookup for "getprocs" did not find a declaration

    Posted Thu April 23, 2009 09:17 AM

    Originally posted by: SystemAdmin


    bar.cpp has been renamed to bar.c

    > xlC_r -q64 bar.c
    // No compilation problem.
    Any explanation?

    I need to compile that file as *.cpp

    Alex Vinokur
    #AIX-Forum


  • 3.  Re: 1540-0274 (S) The name lookup for "getprocs" did not find a declaration

    Posted Thu April 23, 2009 11:01 AM

    Originally posted by: SystemAdmin


    extern "C" should be added


    bar.cpp
    #include <procinfo.h>
    #include <sys/types.h>

    extern "C"
    {
    int getprocs(struct procsinfo*, int, struct fdsinfo*, int, pid_t*, int);
    int getprocs64(struct procentry64*, int, struct fdsinfo64*, int, pid_t*, int);
    }

    int main()
    {
    pid_t retval = (pid_t)0;

    struct procsinfo pinfo;

    getprocs(&pinfo, sizeof(struct procsinfo), 0, 0, &retval, 1);

    struct procentry64 pentry;
    getprocs64(&pentry, sizeof(struct procentry64), 0, 0, &retval, 1);

    return 0;

    }


    > xlC_r -q64 bar.cpp
    // No errors
    #AIX-Forum