1823986 Members
4238 Online
109667 Solutions
New Discussion юеВ

'gmtime_r'

 
SOLVED
Go to solution

'gmtime_r'

Hello

I have include time.h but why given
error: 'gmtime_r' was not declared in this scope
for compilation.

many-many thanks for help...
8 REPLIES 8
Peter Godron
Honored Contributor

Re: 'gmtime_r'

Hi,
can time.h be found in your path ?
WHERE in the code did you include time.h ?
If it is within a function/procedure scope is limited to that part of code.

Re: 'gmtime_r'

Hi its find the path since it's does not given error for other time variable.

I have not include time.h within function/procedure.

its given error for c++ compilation but
in case if compile with c no error is comes.

Regards,
Subrat

Dennis Handly
Acclaimed Contributor

Re: 'gmtime_r'

Compile your code with -E and then look at the output. You'll see that gmtime_r is not defined unless you compile with -mt.
Sandman!
Honored Contributor

Re: 'gmtime_r'

Do you mean that compiling with cc is okay but with aC++ you get errors? Please clarify?

~thanks
Dennis Handly
Acclaimed Contributor

Re: 'gmtime_r'

>Sandman: Do you mean that compiling with cc is okay but with aC++ you get errors?

No. Whether you compile with cc or aCC, you need to use -mt to get the prototype. And if you are a bad guy and don't make missing prototypes an error in C (with -We####), then you may not notice it.

You can compile with +w/+w1 to see what the remark number would be.
PA C: 714 aCC3: 972 aCC6: 2223 and 4242
Sandman!
Honored Contributor

Re: 'gmtime_r'

Good deal Dennis; I usually don't use the "_r" extensions of the std time functions so I didn't run into this issue. Strange 8-( if they are declared in the file, then why is the function prototype missing during compilation?

~cheers
Dennis Handly
Acclaimed Contributor
Solution

Re: 'gmtime_r'

>Sandman: if they are declared in the file, then why is the function prototype missing during compilation?

Because there is a:
#ifdef _REENTRANT

Re: 'gmtime_r'


A lot of thank,s for your support...
Problem is solved by your suggestion.
Thanks