AIX

AIX

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


#Power
 View Only
  • 1.  AIX5.3+g++4.0.2 compile error curtime

    Posted Tue April 20, 2010 02:27 AM

    Originally posted by: yhs1234567890@163.com


    i use eclipse CDT on AIX 5.3 with gcc 4.0.2

    hostb/>oslevel
    5.3.0.0
    hostb/>cd /usr/bin
    hostb/usr/bin>g++ -version
    g++: unrecognized option '-version'
    g++: no input files
    hostb/usr/bin>g++ --version
    g++ (GCC) 4.0.2
    Copyright (C) 2005 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    hostb/usr/bin>
    #include <iostream>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/errno.h>
    #include <sys/time.h>

    int main()
    {
    timestruc_t t;
    curtime(&t);

    pid_t p;
    p=fork();
    if(p!=0)
    {
    printf("parent's pid is %d\n",p);
    }
    else
    {
    printf("child's pid is %d\n",p);
    }
    return 0;
    }

    when i compile this program i got error:
    • Full rebuild of configuration Debug for project mytest ****

    /opt/freeware/bin/make clean all
    rm -rf ./main.o ./main.d main

    Building file: ../main.cpp
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ../main.cpp
    ../main.cpp: In function 'int main()':
    ../main.cpp:10: error: 'curtime' was not declared in this scope
    make: *** http://main.o Error 1
    Build complete for project mytest
    #AIX-Forum


  • 2.  Re: AIX5.3+g++4.0.2 compile error curtime

    Posted Tue April 20, 2010 12:02 PM

    Originally posted by: nagger


    curtime() is not a function on AIX

    Hence the line
    ../main.cpp:10: error: 'curtime' was not declared in this scope

    Either its a spelling mistake or you have to write it.

    ta Nigel
    #AIX-Forum


  • 3.  Re: AIX5.3+g++4.0.2 compile error curtime

    Posted Wed April 21, 2010 10:52 AM

    Originally posted by: flodstrom


    Actually curtime do exist in AIX, but I don't think it's a function that is available for normal applications.

    I could be wrong, but it looks like curtime is a kernel function of some kind.

    I would look for a more conventional way of getting the current system time.
    #AIX-Forum