I have an annoying issue with my C++ programs. I have two programs (a main program and a small helper program that feeds it for testing) which I recenty moved from one system to another. On the new system I started getting an unresolved reference error for the strptime method in the main program. The annoying thing is that the helper program also has the same strptime method and is able to call it without any difficulty. Strptime worked on the old system, both systems are running the same version of centos.
I’ve tried the obvious things to determine why my reference is unresolved. I tried copying every header my helper program had to my main program and it’s still unresolved. I checked eclipse compiler/linker settings and while the main program does a few more things (adds some symbols, includes a few extra folders, and links to the libld) none of the changes seem to explain why one program could recognize strptime. I tried to create a demo program that only used strptime and it was recognized. I’m at a lost now for why I’m getting the error. Can anyone suggest something else I could check for the potential caue of the unresolved reference?
I have verifid that time.h, which I’m linking, contains the strptime method, but it’s defined externally. Is there another .h that the time.h file should include which gives an inline definition of the method?
I haven’t seen this before, but this might help:
From the linux man pages…
http://linux.die.net/man/3/strptime
_XOPEN_SOURCE – Feature Test Macro
Defining this macro causes header files to expose definitions as follows:
• Defining with any value exposes definitions conforming to POSIX.1, POSIX.2, and XPG4.
• The value 500 or greater additionally exposes definitions for SUSv2 (UNIX 98).
• (Since glibc 2.2) The value 600 or greater additionally exposes definitions for SUSv3 (UNIX 03; i.e., the POSIX.1-2001 base specification plus the XSI extension) and C99 definitions.
• (Since glibc 2.10) The value 700 or greater additionally exposes definitions for SUSv4 (i.e., the POSIX.1-2008 base specification plus the XSI extension).