Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Include time.h function (http://www.go4expert.com/forums/include-timeh-function-t3273/)

cky1123 6Mar2007 20:40

Include time.h function
Hi all,

I'm trying to use the C function time() in my program but it keeps complaining "called object is not a function" but I've already included the header file. #include <sys/time.h>
Does this mean it doesn't find the header file and so it does not recognize the function? thanx in advance.


DaWei 6Mar2007 21:22

Re: Include time.h function
Most compilers would give you a "file not found" type of error if an include file is not found. Whether or not the file is in sys or not depends upon the compiler. Have you checked for the presence of the file?

Header files do not include the actual functions. They merely declare their form. The library that contains the actual code must be present and be able to be found during the linker phase. This is unlikely to be the problem with something like time, though.

You should always give information about your system, OS, and compiler; particularly for stranger behavior regarding system library code. Perhaps you could also show a snippet of the code where the error occurs, in case of syntax errors at or shortly before the point where the error is flagged.

cky1123 6Mar2007 23:31

Re: Include time.h function
ops.. i figured it out. I actually had another variable name int time which was causing the problem. Thanx ..

DaWei 7Mar2007 00:05

Re: Include time.h function
Ahhh, the beauty of C++ and namespaces :D.

All times are GMT +5.5. The time now is 22:33.