Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mingw build #2

Closed
mintyc opened this issue Nov 3, 2014 · 13 comments
Closed

Mingw build #2

mintyc opened this issue Nov 3, 2014 · 13 comments
Assignees

Comments

@mintyc
Copy link

mintyc commented Nov 3, 2014

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
@gabime gabime self-assigned this Nov 3, 2014
@gabime
Copy link
Owner

gabime commented Nov 5, 2014

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 gabime closed this as completed Nov 5, 2014
@gabime gabime reopened this Nov 5, 2014
@mintyc
Copy link
Author

mintyc commented Nov 5, 2014

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
Copy link
Author

mintyc commented Nov 5, 2014

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 mintyc closed this as completed Nov 5, 2014
@mintyc mintyc reopened this Nov 5, 2014
@gabime
Copy link
Owner

gabime commented Nov 5, 2014

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..

@mintyc
Copy link
Author

mintyc commented Nov 5, 2014

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 :)

@gabime gabime closed this as completed Nov 5, 2014
@gabime
Copy link
Owner

gabime commented Nov 5, 2014

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

@zaxthealien
Copy link

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

@gabime
Copy link
Owner

gabime commented May 13, 2015

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

@mintyc
Copy link
Author

mintyc commented May 13, 2015

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 notifications@github.com 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
#2 (comment).

@gabime
Copy link
Owner

gabime commented May 13, 2015

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

@zaxthealien
Copy link

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
Copy link

nope. still got the same error.

@sleger0507 sleger0507 mentioned this issue Feb 11, 2016
headupinclouds pushed a commit to headupinclouds/spdlog that referenced this issue Sep 3, 2017
Merge version 0.11.0 from upstream
@fourier
Copy link

fourier commented Dec 11, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants