Linker Error on asctime, ctime, localtime functions... 
Author Message
 Linker Error on asctime, ctime, localtime functions...

Hello Techies--
I'm getting the dreaded: LINK2001 unresolved symbol message when
trying to compile (console application) with the following externals:

#include<iostream>
using std::ostream;

#include<cstdlib>
#include<string>
#include<string.h>
#include<errno.h>
#include<time.h>
extern "C" {

        extern char *ctime_r(const time_t *clock, char *buf);
        extern struct tm *localtime_r(const time_t *clock,
                struct tm *result);
        extern struct tm *gmtime_r(const time_t *clock, struct tm *result);
        extern char *asctime_r(const struct tm *tm, char *buf);

 }

< snip >

My project settings for linker look like:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib winmm.lib wininet.lib shell32.lib /nologo
/subsystem:console /incremental:yes
/pdb:"Debug/NTTimer.pdb" /debug /machine:I386 /out:"Debug/NTTimer.exe"
/pdbtype:sept

..any insight into this would be greatly appreciated.  By the way, the
same code compiles on LINUX without a glitch!

Warm regards,
Paula DiTallo



Tue, 25 May 2004 02:51:28 GMT  
 Linker Error on asctime, ctime, localtime functions...


Quote:
> Hello Techies--
> I'm getting the dreaded: LINK2001 unresolved symbol message when
> trying to compile (console application) with the following externals:

> #include<iostream>
> using std::ostream;

> #include<cstdlib>
> #include<string>
> #include<string.h>
> #include<errno.h>
> #include<time.h>
> extern "C" {

> extern char *ctime_r(const time_t *clock, char *buf);
> extern struct tm *localtime_r(const time_t *clock,
> struct tm *result);
> extern struct tm *gmtime_r(const time_t *clock, struct tm *result);
> extern char *asctime_r(const struct tm *tm, char *buf);

>  }

> < snip >

> My project settings for linker look like:

> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> odbccp32.lib winmm.lib wininet.lib shell32.lib /nologo
> /subsystem:console /incremental:yes
> /pdb:"Debug/NTTimer.pdb" /debug /machine:I386 /out:"Debug/NTTimer.exe"
> /pdbtype:sept

> ..any insight into this would be greatly appreciated.  By the way, the
> same code compiles on LINUX without a glitch!

What exactly are the unresolved externals - asctime, ctime, etc. or
asctime_r, ctime_r, etc.?
The latter functions don't exist in VC as far as I can see.

--
Jay



Tue, 25 May 2004 02:57:11 GMT  
 Linker Error on asctime, ctime, localtime functions...

Quote:
> What exactly are the unresolved externals - asctime, ctime, etc. or
> asctime_r, ctime_r, etc.?
> The latter functions don't exist in VC as far as I can see.

The _r functions are not part of standard C, they are POSIX functions.

Paul



Thu, 27 May 2004 20:07:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. statics in asctime/localtime ?

2. Bugs in time(), localtime(), and CTime

3. CTime/localtime bug in 4/1/2001?

4. Linker error LNK2001, RegisterServiceProcess function

5. Linker error LNK2001, RegisterServiceProcess function

6. template function linker error

7. Linker error with function templates in VC7.1

8. HELP! Linker error with template class functions

9. vc++ 5 linker error with mapi functions

10. Linker error when calling functions from library

11. Linker error using WinInet functions

12. Linker error (LNK2001) with Video Capture functions.

 

 
Powered by phpBB® Forum Software