Compiler Error in CodeWarrior

Hi All:

I have a project written on the Mac in CodeWarrior (it is a plugin for InDesign, which requires CW on the Mac) that provides me with the following error several times:

Error: Declaration syntax error
time.h line 48 time_t tv_sec;

The header file has the following two statements at the top:

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

I recognize that time_t is a type of array, probably defined in sys/types.h. I have checked access paths and found them to be correct. Why can't the compiler find sys/types.h?

I would appreciate any help you can give me.

TIA!
John
[668 byte] By [pedantic] at [2007-11-19 7:29:39]
# 1 Re: Compiler Error in CodeWarrior
If time_t is defined in <sys/types.h>, then you have to include it first.

#include <sys/types.h>
#include <time.h>
Bob Davis at 2007-11-9 0:42:30 >
# 2 Re: Compiler Error in CodeWarrior
Unfortunately, this is a system header. Should I have to change a system header, and is it safe so to do?
pedantic at 2007-11-9 0:43:31 >
# 3 Re: Compiler Error in CodeWarrior
There's no way to say for sure. In most cases it won't be a problem; give it a try and see.
Bob Davis at 2007-11-9 0:44:31 >
# 4 Re: Compiler Error in CodeWarrior
Unfortunately, this is a system header. Should I have to change a system header, and is it safe so to do?
The error is most unlikely to be in a third-party header!
I would recommend against changing them!!

For instance, when one works with STL, an incorrect predicate usage may take one to the <list> header --> of course, the fault is not with the list!! :D

Besides that, will you go about fixing third-party headers on every PC you want your program to be built on?

Please review your code, inclusions and your usage of time_t objects. :)

Perhaps, posting your code here will help! :wave:
Siddhartha at 2007-11-9 0:45:37 >