Include time.h function

cky1123's Avatar, Join Date: Jan 2007
Go4Expert Member
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.

Catherine
DaWei's Avatar, Join Date: Dec 2006
Team Leader
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's Avatar, Join Date: Jan 2007
Go4Expert Member
ops.. i figured it out. I actually had another variable name int time which was causing the problem. Thanx ..
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Ahhh, the beauty of C++ and namespaces .