Closed abumq closed 11 years ago
Log here: http://haste.alluha.net/sumate.txt
EasyLogging++ - HEAD (8.47?) MinGW - 3.20 G++ - 4.7.2
Great thanks for that
Looks like compiler is not including Windows.h header.will look into fixing this asap
Verbose compilation
>C:\MinGW\bin\g++ -v prog.cc -o prog
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r
untime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-o' 'prog.exe' '-shared-libgcc' '-mtune=i386' '-march=
i386'
c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/cc1plus.exe -quiet -v -iprefix c:\min
gw\bin\../lib/gcc/mingw32/4.6.2/ prog.cc -quiet -dumpbase prog.cc -mtune=i386 -m
arch=i386 -auxbase prog -version -o C:\Users\Majid\AppData\Local\Temp\ccU3OpfY.s
GNU C++ (GCC) version 4.6.2 (mingw32)
compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../.
./mingw32/include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/inclu
de/c++"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/inclu
de/c++/mingw32"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/inclu
de/c++/backward"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/inclu
de"
ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.6.2/../../../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/inclu
de-fixed"
ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/../
../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/mingw32
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/backward
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include-fixed
End of search list.
GNU C++ (GCC) version 4.6.2 (mingw32)
compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f7eb4168c2cf10318cc29da8d23b7f3c
In file included from prog.cc:2:0:
easylogging++.h: In static member function 'static const string easyloggingpp::i
nternal::utilities::OSUtils::currentUser()':
easylogging++.h:665:46: error: '_dupenv_s' was not declared in this scope
easylogging++.h: In static member function 'static const string easyloggingpp::i
nternal::utilities::OSUtils::currentHost()':
easylogging++.h:690:50: error: '_dupenv_s' was not declared in this scope
easylogging++.h: In static member function 'static bool easyloggingpp::internal:
:utilities::OSUtils::createPath(const string&)':
easylogging++.h:755:62: error: 'strtok_s' was not declared in this scope
easylogging++.h: In static member function 'static std::string easyloggingpp::in
ternal::utilities::DateUtils::getDateTime(const string&, unsigned int, easyloggi
ngpp::internal::Constants*, unsigned int)':
easylogging++.h:860:60: error: 'sprintf_s' was not declared in this scope
easylogging++.h:867:103: error: 'sprintf_s' was not declared in this scope
easylogging++.h:869:84: error: 'sprintf_s' was not declared in this scope
easylogging++.h: In member function 'easyloggingpp::internal::Writer& easyloggin
gpp::internal::Writer::operator<<(const wchar_t*)':
easylogging++.h:2479:69: error: 'wcsrtombs_s' was not declared in this scope
So windows header is included but mingw version of following versions are not defined
From an old 2009 thread, but relevant it seems: "There is no question of MinGW "getting" strtok_s(); as an end user, you may choose to download the appropriate DLLs from Microsoft's own site, but we cannot distribute them. However, we can consider patches to add additional import library references, properly conditionalised to support the functions added in later versions of MSVCRT, but beyond that we cannot go; users who wish to exploit such later runtime versions must acquire the appropriate DLLs for themselves, and developers requiring them must configure their own MinGW installations to deploy them."
This guy defined strtok_r() himself: https://github.com/kwolekr/minetest/commit/69ba4854152415ab3e2ec11cdb6f9c9ce5af9ac8
Joe, yes this is relevant and I believe the solution would be to write my own version of these functions if using minGW in internal::workarounds namespace. The reason why I use these functions instead of standard C functions is because they are deprecated in VC++ and it gives warning. As library author I am concerned with compiler's warnings as this defeats users' motivation towards libraries.
Well I will have a look at better way of resolving this, if not I will go with what I said in the beginning - write custom workarounds
No worries man, I understand completely what you're saying :) I'm not knocking your implementation, just looking to use my fav logging library on MinGW :D
Alright, keep us posted! And good luck! ;)
Thanks for that, sure I will
A note, an example from Microsoft MSDN website http://msdn.microsoft.com/en-us/library/ftsafwz3(v=vs.80).aspx does not work with minGW either.
For path creation we can use CreateDirectory(.., ..)
for windows so we don't have to write strtok_s func (http://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx)
For username and computer name we can use GetEnvironmentVariable
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms683188(v=vs.85).aspx)
Nice find!
For sprintf_s, this works from what I'm reading:
Apparently there is snprintf on windows too, as _snprintf, so we could try:
Just depends which way round you want to fix it I suppose.
Great so that works with minGW?
oh snprintf is for C++11 apps and I intend to support C++98 as well for EasyLogging++
http://www.cplusplus.com/reference/cstdio/snprintf/
hmm but good finding but will have a look at what could be done :)
ok so because snprintf is C++11 way, I will do something like:
#if defined(_MSC_VER) // VC++
# define SPRINTF sprintf_s
#else
# define SPRINTF sprintf
#endif
and then use
SPRINTF(...)
now the only thing left is wcstomb_s()
Ah didn't spot that, will keep looking. Maybe we could use sprintf rather than snprintf?
Haha, great minds think alike ;D Yup, looking at it :)
Joe, I used sprintf in the first place until realized MS way of doing stuff :) VC++ gives warning of deprecated func. so I believe above way would be good :)
Agreed, you just managed to comment faster than me :P
Would wcstombs()
be a good replacement for wcsrtombs_s()
on mingw?
I will have a look, I am not sure if thats deprecated as well. but surely good idea, even if it is I can do same thing as with SPRINTF macro. I haven't done any coding yet but i guess I will have enough information to code faster once I am ready for it, assigning 8.50 milestone to this ticket
This is completed v8.50, let me know how'd you go :)
Yup all working fine, cheers mate :D
For details: https://www.facebook.com/icplusplus/posts/566945396679629?comment_id=6509000&offset=0&total_comments=1¬if_t=share_comment