Skip to content

[compilation error] 'localtime_s' was not declared in this scope #282

Closed
@erusyd

Description

@erusyd

Bug category

  • bug - compilation error
  • bug - compilation warning
  • bug - runtime error
  • bug - runtime warning
  • bug - logic error

Describe the bug
Compile from the source, it complains:
error: ‘localtime_s’ was not declared in this scope

Steps to Reproduce

# Your steps go here
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF 
sudo cmake --build . --parallel 2 --config Release
sudo cmake --install .

Output
/source/matplot/core/axis_type.cpp:260:21: error: ‘localtime_s’ was not declared in this scope; did you mean ‘localtime_r’?
260 | localtime_s(&buf, &now);
| ^~~~~~~~~~~
| localtime_r
make[2]: *** [source/matplot/CMakeFiles/matplot.dir/build.make:128: source/matplot/CMakeFiles/matplot.dir/core/axis_type.cpp.o] Error 1

# The output you got

Platform

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: linux mint
  • OS Version: 20.3
  • Compiler: g++
  • Compiler version: 9.4.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions