Skip to content

implicit declaration of function ‘strptime’ #47

@Sembiance

Description

@Sembiance

Attempting to compile on Gentoo Linux with gcc (Gentoo 15.1.0 p55) 15.1.0 and glibc-2.41-r1 I get the following error:

Compiling: Src/Dc_Shared.c -> build/release/Src/Dc_Shared.o
In file included from Src/Dc_Shared.c:16:
Src/File_AppleSingle.h:20:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
   20 | const unsigned static int AS_MAGIC;
      | ^~~~~
Src/Dc_Prodos.c: In function ‘UpdateProdosImage’:
Src/Dc_Prodos.c:170:10: warning: variable ‘nb_write’ set but not used [-Wunused-but-set-variable]
  170 |   int i, nb_write;
      |          ^~~~~~~~
Src/Dc_Prodos.c: In function ‘GetDataFile’:
Src/Dc_Prodos.c:1719:50: warning: variable ‘resource_blocks_used’ set but not used [-Wunused-but-set-variable]
 1719 |   int resource_storage_type, resource_key_block, resource_blocks_used, resource_eof;
      |                                                  ^~~~~~~~~~~~~~~~~~~~
Src/Dc_Prodos.c:1718:42: warning: variable ‘data_blocks_used’ set but not used [-Wunused-but-set-variable]
 1718 |   int data_storage_type, data_key_block, data_blocks_used, data_eof;
      |                                          ^~~~~~~~~~~~~~~~
Src/Dc_Prodos.c: In function ‘GetCurrentDate’:
Src/Dc_Prodos.c:2219:5: error: implicit declaration of function ‘strptime’; did you mean ‘strftime’? [-Wimplicit-function-declaration]
 2219 |     strptime(source_date_epoch_env, "%s", &source_date_epoch_tm);
      |     ^~~~~~~~
      |     strftime
make[1]: *** [Makefile:222: build/release/Src/Dc_Prodos.o] Error 1
make[1]: *** Waiting for unfinished jobs....
	 Compile time: 00:00:00
	 Compile time: 00:00:00
make: *** [Makefile:153: release] Error 2

Adding to the top of src/Dc_Prodos.c:

#define _XOPEN_SOURCE 700

Fixes it. Not sure if that's the proper solution or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions