Skip to content

Compile issue in Time.cc #12

Description

@Sembiance

On linux 5.18.8 running g++ 12.1.1_p20220628 p8 with glibc 2.35-r7 I get the following compile error with latest phosg master code as of July 3, 2022:

[2/43] /usr/bin/x86_64-pc-linux-gnu-g++ -Dphosg_EXPORTS -I/usr/local/include  -DNDEBUG -O2 -march=native -pipe -fPIC -Wall -Wextra -Werror -Wno-strict-aliasing -Wno-unused-result -Wno-overflow -std=gnu++20 -MD -MT CMakeFiles/phosg.dir/src/Time.cc.o -MF CMakeFiles/phosg.dir/src/Time.cc.o.d -o CMakeFiles/phosg.dir/src/Time.cc.o -c /var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc
FAILED: CMakeFiles/phosg.dir/src/Time.cc.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -Dphosg_EXPORTS -I/usr/local/include  -DNDEBUG -O2 -march=native -pipe -fPIC -Wall -Wextra -Werror -Wno-strict-aliasing -Wno-unused-result -Wno-overflow -std=gnu++20 -MD -MT CMakeFiles/phosg.dir/src/Time.cc.o -MF CMakeFiles/phosg.dir/src/Time.cc.o.d -o CMakeFiles/phosg.dir/src/Time.cc.o -c /var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc: In function ‘std::string format_time(uint64_t)’:
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:19:13: error: aggregate ‘tm t_parsed’ has incomplete type and cannot be defined
   19 |   struct tm t_parsed;
      |             ^~~~~~~~
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:20:3: error: ‘gmtime_r’ was not declared in this scope; did you mean ‘time_t’?
   20 |   gmtime_r(&t_secs, &t_parsed);
      |   ^~~~~~~~
      |   time_t
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:23:16: error: ‘strftime’ was not declared in this scope
   23 |   size_t len = strftime(ret.data(), ret.size(),
      |                ^~~~~~~~

Simply adding a #include <time.h> fixes the issue.

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