spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Mingw build

Open mintyc opened this issue 12 years ago • 13 comments

Using 4.9.1 mingw64 and building examples

  1. make all in examples dir doesn't find 'makefile'. Recapitalise to 'Makefile' and all OK

  2. details/os.h uses GetDynamicTimeZoneInfo from windows.h mingw defaults to _WIN32_WINNT=0x502 (XP) so doesn't find this newer api

a) Adjust Makefile to add -D_WIN32_WINNT=0x600 or b) add logic into os.h to cater for this or adapt to XP targets by using a different API

  1. Same function in os.h reports unused variable warning for tm

inline int utc_minutes_offset(const std::tm& tm = localtime()) {

ifdef _WIN32

(void)tm;   // avoid unused param warning

mintyc avatar Nov 03 '14 15:11 mintyc

I didn't manage to compile at all using mingw (64 bits, g++4.9.1 nuwen.net distribution) It give lots of errors. Any hint on how to solve this?

In file included from ../include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0,
                 from ../include/spdlog/sinks/../formatter.h:57,
                 from ../include/spdlog/sinks/base_sink.h:36,
                 from ../include/spdlog/logger.h:36,
                 from ../include/spdlog/spdlog.h:31,
                 from example.cpp:29:
../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::localtime(const time_t&)':
../include/spdlog/sinks/../details/./os.h:49:30: error: 'localtime_r' was not declared in this scope
     localtime_r(&time_tt, &tm);
                              ^
../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::gmtime(const time_t&)':
../include/spdlog/sinks/../details/./os.h:69:27: error: 'gmtime_r' was not declared in this scope
     gmtime_r(&time_tt, &tm);
                           ^
../include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::utc_minutes_offset(const tm&)':
../include/spdlog/sinks/../details/./os.h:144:15: error: 'const struct tm' has no member named 'tm_gmtoff'
     return tm.tm_gmtoff / 60;
               ^
In file included from ../include/spdlog/sinks/../formatter.h:57:0,
                 from ../include/spdlog/sinks/base_sink.h:36,
                 from ../include/spdlog/logger.h:36,
                 from ../include/spdlog/spdlog.h:31,
                 from example.cpp:29:
../include/spdlog/sinks/../details/pattern_formatter_impl.h: At global scope:
../include/spdlog/sinks/../details/pattern_formatter_impl.h:319:10: error: 'mutex' in namespace 'std' does not name a type
     std::mutex _mutex;
          ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h: In member function 'virtual void spdlog::details::z_formatter::format(spdlog::details::log_msg&)':
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> l(_mutex);
                         ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:25: error: 'mutex' is not a member of 'std'
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> l(_mutex);
                                   ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:38: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> l(_mutex);
                                      ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:39: error: '_mutex' was not declared in this scope
         std::lock_guard<std::mutex> l(_mutex);
                                       ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h:305:37: warning: unused variable 'l' [-Wunused-variable]
         std::lock_guard<std::mutex> l(_mutex);
                                     ^
../include/spdlog/sinks/../details/pattern_formatter_impl.h: In member function 'virtual void spdlog::details::t_formatter::format(spdlog::details::log_msg&)':
../include/spdlog/sinks/../details/pattern_formatter_impl.h:342:31: error: 'std::this_thread' has not been declared
         msg.formatted << std::this_thread::get_id();
                               ^
In file included from ../include/spdlog/details/spdlog_impl.h:30:0,
                 from ../include/spdlog/spdlog.h:108,
                 from example.cpp:29:
../include/spdlog/details/registry.h: At global scope:
../include/spdlog/details/registry.h:126:10: error: 'mutex' in namespace 'std' does not name a type
     std::mutex _mutex;
          ^
../include/spdlog/details/registry.h: In member function 'std::shared_ptr<spdlog::logger> spdlog::details::registry::get(const string&)':
../include/spdlog/details/registry.h:48:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> lock(_mutex);
                         ^
../include/spdlog/details/registry.h:48:25: error: 'mutex' is not a member of 'std'
../include/spdlog/details/registry.h:48:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> lock(_mutex);
                                   ^
../include/spdlog/details/registry.h:48:41: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> lock(_mutex);
                                         ^
../include/spdlog/details/registry.h:48:42: error: '_mutex' was not declared in this scope
         std::lock_guard<std::mutex> lock(_mutex);
                                          ^
../include/spdlog/details/registry.h:48:37: warning: unused variable 'lock' [-Wunused-variable]
         std::lock_guard<std::mutex> lock(_mutex);
                                     ^
../include/spdlog/details/registry.h: In member function 'std::shared_ptr<spdlog::logger> spdlog::details::registry::create(const string&, const It&, const It&)':
../include/spdlog/details/registry.h:56:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> lock(_mutex);
                         ^
../include/spdlog/details/registry.h:56:25: error: 'mutex' is not a member of 'std'
../include/spdlog/details/registry.h:56:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> lock(_mutex);
                                   ^
../include/spdlog/details/registry.h:56:41: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> lock(_mutex);
                                         ^
../include/spdlog/details/registry.h:56:42: error: '_mutex' was not declared in this scope
         std::lock_guard<std::mutex> lock(_mutex);
                                          ^
../include/spdlog/details/registry.h: In member function 'void spdlog::details::registry::formatter(spdlog::formatter_ptr)':
../include/spdlog/details/registry.h:83:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> lock(_mutex);
                         ^
../include/spdlog/details/registry.h:83:25: error: 'mutex' is not a member of 'std'
../include/spdlog/details/registry.h:83:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> lock(_mutex);
                                   ^
../include/spdlog/details/registry.h:83:41: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> lock(_mutex);
                                         ^
../include/spdlog/details/registry.h:83:42: error: '_mutex' was not declared in this scope
         std::lock_guard<std::mutex> lock(_mutex);
                                          ^
../include/spdlog/details/registry.h:83:37: warning: unused variable 'lock' [-Wunused-variable]
         std::lock_guard<std::mutex> lock(_mutex);
                                     ^
../include/spdlog/details/registry.h: In member function 'void spdlog::details::registry::set_pattern(const string&)':
../include/spdlog/details/registry.h:92:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> lock(_mutex);
                         ^
../include/spdlog/details/registry.h:92:25: error: 'mutex' is not a member of 'std'
../include/spdlog/details/registry.h:92:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> lock(_mutex);
                                   ^
../include/spdlog/details/registry.h:92:41: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> lock(_mutex);
                                         ^

gabime avatar Nov 05 '14 01:11 gabime

I didn't find STL's packaged version too useful, can't remember exactly why but it was missing some things I needed [ threading support, I think...]

There are a range of builds here: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/

I use http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.1/threads-posix/seh/

This worked out of the box with the mods I suggested

Note I see he's just added 4.9.2 builds there this week....

Paul

mintyc avatar Nov 05 '14 12:11 mintyc

Just tested with the new 4.9.2 release - looking good!

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-posix/seh/ Mingw64 4.9.2 posix - seh install - unzip to wherever Add it's bin dir to the path (in mingw64/bin dir you may want a link or copy of mingw32-make.exe to make.exe for convenience)

From latest spdlog git (has a couple of the fixes above already included)

In examples dir Added -D_WIN32_WINNT=0x600 to end of CXXFLAGS (should probably add in a #ifdef WIN32)

make all Builds example.exe and bench.exe - both run successfully

mintyc avatar Nov 05 '14 12:11 mintyc

Great. So I assume the only thing left before declaring that mingw is supported is to create a new "Makefile.mingw" in example and bench dirs where the -D_WIN32_WINNT flag is set to 0x600..

gabime avatar Nov 05 '14 13:11 gabime

The alternative, to allow building from or targeting of Win XP for visual studio users as well, would be to rework the timezone offset in os.h to use something supported way back when. - I don't know windows APIs so can't help with that.

I know a lot of projects where even when dev-ing from more modern machines, they must still target XP and above - hence the furore when Microsoft was late in rolling out an XP targeting pack for newer visual studio release (2012).

Personally I'd just stick with your suggestion as supporting very old configurations is difficult at the best of times, besides, my work XP machine is (finally) being upgraded to Win 7 next week :)

mintyc avatar Nov 05 '14 13:11 mintyc

Added Mafile.mingw in example with -D_WIN32_WINNT=0x600

gabime avatar Nov 05 '14 21:11 gabime

Tried to compile the examples with provided makefile.mingw, the one with -D_WIN32_WINNT=0x600 and didn't manage to compile it too. the DYNAMIC_TIME_ZONE_INFORMATION was still not declared. I used tdm-gcc 4.9.2 from http://tdm-gcc.tdragon.net/ it compiles finely with vs2013 and linux gcc on ubuntu though. any idea why?

In file included from ../include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0,
                 from ../include/spdlog/sinks/../formatter.h:57,
                 from ../include/spdlog/sinks/base_sink.h:36,
                 from ../include/spdlog/logger.h:36,
                 from ../include/spdlog/spdlog.h:33,
                 from example.cpp:29:
../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::localtime(const time_t&)':
../include/spdlog/sinks/../details/./os.h:71:30: error: 'localtime_s' was not declared in this scope
     localtime_s(&tm, &time_tt);
                              ^
../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::gmtime(const time_t&)':
../include/spdlog/sinks/../details/./os.h:91:27: error: 'gmtime_s' was not declared in this scope
     gmtime_s(&tm, &time_tt);
                           ^
../include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::fopen_s(FILE**, const string&, const char*)':
../include/spdlog/sinks/../details/./os.h:148:45: error: '_SH_DENYWR' was not declared in this scope
     *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR);
                                             ^
../include/spdlog/sinks/../details/./os.h:148:55: error: '_fsopen' was not declared in this scope
     *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR);
                                                       ^
../include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::utc_minutes_offset(const tm&)':
../include/spdlog/sinks/../details/./os.h:164:5: error: 'DYNAMIC_TIME_ZONE_INFORMATION' was not declared in this scope
     DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
     ^
../include/spdlog/sinks/../details/./os.h:165:46: error: 'tzinfo' was not declared in this scope
     auto rv = GetDynamicTimeZoneInformation(&tzinfo);
                                              ^
../include/spdlog/sinks/../details/./os.h:165:52: error: 'GetDynamicTimeZoneInformation' was not declared in this scope
     auto rv = GetDynamicTimeZoneInformation(&tzinfo);
                                                    ^
In file included from ../include/spdlog/sinks/./../details/./format.h:3008:0,
                 from ../include/spdlog/sinks/./../details/log_msg.h:29,
                 from ../include/spdlog/sinks/./sink.h:27,
                 from ../include/spdlog/sinks/base_sink.h:35,
                 from ../include/spdlog/logger.h:36,
                 from ../include/spdlog/spdlog.h:33,
                 from example.cpp:29:
../include/spdlog/sinks/./../details/./format.cc: In instantiation of 'static int fmt::internal::CharTraits<wchar_t>::format_float(wchar_t*, std::size_t, const wchar_t*, unsigned int, int, T) [with T = double; std::size_t = unsigned int]':
../include/spdlog/sinks/./../details/./format.cc:1177:48:   required from here
../include/spdlog/sinks/./../details/./format.cc:400:52: error: 'swprintf' was not declared in this scope
                swprintf(buffer, size, format, value) :
                                                    ^
../include/spdlog/sinks/./../details/./format.cc:401:63: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
                swprintf(buffer, size, format, precision, value);
                                                               ^
../include/spdlog/sinks/./../details/./format.cc:400:52: note: 'swprintf' declared here, later in the translation unit
                swprintf(buffer, size, format, value) :
                                                    ^
../include/spdlog/sinks/./../details/./format.cc:404:55: error: 'swprintf' was not declared in this scope
            swprintf(buffer, size, format, width, value) :
                                                       ^
../include/spdlog/sinks/./../details/./format.cc:405:66: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
            swprintf(buffer, size, format, width, precision, value);
                                                                  ^
../include/spdlog/sinks/./../details/./format.cc:404:55: note: 'swprintf' declared here, later in the translation unit
            swprintf(buffer, size, format, width, value) :
                                                       ^
../include/spdlog/sinks/./../details/./format.cc: In instantiation of 'static int fmt::internal::CharTraits<wchar_t>::format_float(wchar_t*, std::size_t, const wchar_t*, unsigned int, int, T) [with T = long double; std::size_t = unsigned int]':
../include/spdlog/sinks/./../details/./format.cc:1181:53:   required from here
../include/spdlog/sinks/./../details/./format.cc:400:52: error: 'swprintf' was not declared in this scope
                swprintf(buffer, size, format, value) :
                                                    ^
../include/spdlog/sinks/./../details/./format.cc:401:63: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
                swprintf(buffer, size, format, precision, value);
                                                               ^
../include/spdlog/sinks/./../details/./format.cc:400:52: note: 'swprintf' declared here, later in the translation unit
                swprintf(buffer, size, format, value) :
                                                    ^
../include/spdlog/sinks/./../details/./format.cc:404:55: error: 'swprintf' was not declared in this scope
            swprintf(buffer, size, format, width, value) :
                                                       ^
../include/spdlog/sinks/./../details/./format.cc:405:66: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
            swprintf(buffer, size, format, width, precision, value);
                                                                  ^
../include/spdlog/sinks/./../details/./format.cc:404:55: note: 'swprintf' declared here, later in the translation unit
            swprintf(buffer, size, format, width, value) :
                                                       ^
In file included from ../include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0,
                 from ../include/spdlog/sinks/../formatter.h:57,
                 from ../include/spdlog/sinks/base_sink.h:36,
                 from ../include/spdlog/logger.h:36,
                 from ../include/spdlog/spdlog.h:33,
                 from example.cpp:29:
../include/spdlog/sinks/../details/./os.h:172:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [example] Error 1

zaxthealien avatar May 13 '15 09:05 zaxthealien

I am not sure. If you manage to fix it, please inform how

gabime avatar May 13 '15 10:05 gabime

I did originally submit a fix for this, but I don't think mingw is currently supported as some of the fixes were subsequently reverted :(

They were a bit clunky (e.g. separate makefile) but I do think it is an important platform to support.

Paul

On 13 May 2015 at 10:12, zaxthealien [email protected] wrote:

Tried to compile the examples with provided makefile.mingw, the one with -D_WIN32_WINNT=0x600 and didn't manage to compile it too. the DYNAMIC_TIME_ZONE_INFORMATION was still not declared. I used tdm-gcc 4.9.2 from http://tdm-gcc.tdragon.net/ any idea why?

In file included from ../include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0, from ../include/spdlog/sinks/../formatter.h:57, from ../include/spdlog/sinks/base_sink.h:36, from ../include/spdlog/logger.h:36, from ../include/spdlog/spdlog.h:33, from example.cpp:29: ../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::localtime(const time_t&)': ../include/spdlog/sinks/../details/./os.h:71:30: error: 'localtime_s' was not declared in this scope localtime_s(&tm, &time_tt); ^ ../include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::gmtime(const time_t&)': ../include/spdlog/sinks/../details/./os.h:91:27: error: 'gmtime_s' was not declared in this scope gmtime_s(&tm, &time_tt); ^ ../include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::fopen_s(FILE*, const string&, const char)': ../include/spdlog/sinks/../details/./os.h:148:45: error: '_SH_DENYWR' was not declared in this scope _fp = fsopen((filename.c_str()), mode, SH_DENYWR); ^ ../include/spdlog/sinks/../details/./os.h:148:55: error: 'fsopen' was not declared in this scope *fp = fsopen((filename.c_str()), mode, SH_DENYWR); ^ ../include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::utc_minutes_offset(const tm&)': ../include/spdlog/sinks/../details/./os.h:164:5: error: 'DYNAMIC_TIME_ZONE_INFORMATION' was not declared in this scope DYNAMIC_TIME_ZONE_INFORMATION tzinfo; ^ ../include/spdlog/sinks/../details/./os.h:165:46: error: 'tzinfo' was not declared in this scope auto rv = GetDynamicTimeZoneInformation(&tzinfo); ^ ../include/spdlog/sinks/../details/./os.h:165:52: error: 'GetDynamicTimeZoneInformation' was not declared in this scope auto rv = GetDynamicTimeZoneInformation(&tzinfo); ^ In file included from ../include/spdlog/sinks/./../details/./format.h:3008:0, from ../include/spdlog/sinks/./../details/log_msg.h:29, from ../include/spdlog/sinks/./sink.h:27, from ../include/spdlog/sinks/base_sink.h:35, from ../include/spdlog/logger.h:36, from ../include/spdlog/spdlog.h:33, from example.cpp:29: ../include/spdlog/sinks/./../details/./format.cc: In instantiation of 'static int fmt::internal::CharTraits<wchar_t>::format_float(wchar_t, std::size_t, const wchar_t, unsigned int, int, T) [with T = double; std::size_t = unsigned int]': ../include/spdlog/sinks/./../details/./format.cc:1177:48: required from here ../include/spdlog/sinks/./../details/./format.cc:400:52: error: 'swprintf' was not declared in this scope swprintf(buffer, size, format, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:401:63: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] swprintf(buffer, size, format, precision, value); ^ ../include/spdlog/sinks/./../details/./format.cc:400:52: note: 'swprintf' declared here, later in the translation unit swprintf(buffer, size, format, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:404:55: error: 'swprintf' was not declared in this scope swprintf(buffer, size, format, width, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:405:66: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] swprintf(buffer, size, format, width, precision, value); ^ ../include/spdlog/sinks/./../details/./format.cc:404:55: note: 'swprintf' declared here, later in the translation unit swprintf(buffer, size, format, width, value) : ^ ../include/spdlog/sinks/./../details/./format.cc: In instantiation of 'static int fmt::internal::CharTraits<wchar_t>::format_float(wchar_t, std::size_t, const wchar_t, unsigned int, int, T) [with T = long double; std::size_t = unsigned int]': ../include/spdlog/sinks/./../details/./format.cc:1181:53: required from here ../include/spdlog/sinks/./../details/./format.cc:400:52: error: 'swprintf' was not declared in this scope swprintf(buffer, size, format, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:401:63: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] swprintf(buffer, size, format, precision, value); ^ ../include/spdlog/sinks/./../details/./format.cc:400:52: note: 'swprintf' declared here, later in the translation unit swprintf(buffer, size, format, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:404:55: error: 'swprintf' was not declared in this scope swprintf(buffer, size, format, width, value) : ^ ../include/spdlog/sinks/./../details/./format.cc:405:66: error: 'swprintf' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] swprintf(buffer, size, format, width, precision, value); ^ ../include/spdlog/sinks/./../details/./format.cc:404:55: note: 'swprintf' declared here, later in the translation unit swprintf(buffer, size, format, width, value) : ^ In file included from ../include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0, from ../include/spdlog/sinks/../formatter.h:57, from ../include/spdlog/sinks/base_sink.h:36, from ../include/spdlog/logger.h:36, from ../include/spdlog/spdlog.h:33, from example.cpp:29: ../include/spdlog/sinks/../details/./os.h:172:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ make: ** [example] Error 1

— Reply to this email directly or view it on GitHub https://github.com/gabime/spdlog/issues/2#issuecomment-101584014.

mintyc avatar May 13 '15 10:05 mintyc

I tested with mingw 4.9.x 64 bits and it worked fine.. @mintyc if you have makefile that fixes the problem under tdm, please send it to me or do pull

gabime avatar May 13 '15 10:05 gabime

I used 32bit version before. Tried tdm-gcc 64bit 4.9.2, still failed. I'll try mingw64 build. maybe it's just tdm's mingw build issue

In file included from C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/pattern_formatter_impl.h:36:0,
                 from C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../formatter.h:57,
                 from C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/base_sink.h:36,
                 from C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/logger.h:36,
                 from C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/spdlog.h:33,
                 from ../src/main.cpp:4:
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::localtime(const time_t&)':
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h:71:30: error: 'localtime_s' was not declared in this scope
     localtime_s(&tm, &time_tt);
                              ^
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h: In function 'tm spdlog::details::os::gmtime(const time_t&)':
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h:91:27: error: 'gmtime_s' was not declared in this scope
     gmtime_s(&tm, &time_tt);
                           ^
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h: In function 'int spdlog::details::os::fopen_s(FILE**, const string&, const char*)':
C:/mount/theFuture/InYourInnerBrain/beatme/svn/beatme_touchdown/sources/lib/spdlog-master/spdlog-master/include/spdlog/sinks/../details/./os.h:148:45: error: '_SH_DENYWR' was not declared in this scope
     *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR);
                                             ^
mingw32-make: *** [../mingw-build/obj/main.o] Error 1

zaxthealien avatar May 13 '15 10:05 zaxthealien

nope. still got the same error.

zaxthealien avatar May 13 '15 11:05 zaxthealien

The compilation issue with tdm-gcc 4.9.2 and localtime_s related errors could be avoided by adding -DMINGW_HAS_SECURE_API=1 to the defines while compiling your project and spdlog.

fourier avatar Dec 11 '18 09:12 fourier