Problems link wxWidgets 3.0.2 in Window 8 using TDM 64 (GCC 4.9.2)

1,353 views
Skip to first unread message

lc

unread,
Mar 17, 2015, 7:27:58 AM3/17/15
to wx-u...@googlegroups.com
Hi all,

I'm using wxWidgets with MinGW/TDM since wx version 2.8, almost without any problems.

Yesterday I downloaded the last version of TDM and wxWidgets to compile my project, and since then I'm having some problems. I always built the library with the commands:

mingw32-make -f makefile.gcc BUILD=debug SHARED=0 UNICODE=1
mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1

This time it doesn't work. It complained about the C++11. So I've changed to the following and it worked.

C:\wxWidgets-3.0.2\build\msw>mingw32-make -f makefile.gcc BUILD=debug SHARED=0 UNICODE=1 CXXFLAGS=-std=c++11 -Wall
C:\wxWidgets-3.0.2\build\msw>mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 CXXFLAGS=-std=c++11 -Wall

After that, I tried to compile my project, but I'm facing some problems during the link stage. I've used the command below and the error message is:

g++ -static -static-libgcc -Wl,--subsystem,windows -mwindows "-LC:\\wxWidgets-3.0.2\\lib\\gcc_lib64" "-LC:\\wxWidgets-3.0.2\\lib\\gcc_lib" "-LC:\\wxWidgets-3.0.2\\lib" -o File.exe ALL_OBJECTS_FILES.O -lwxmsw30u_xrc -lwxmsw30u_gl -lopengl32 -lglu32 -lfreeglut -lwxmsw30u_richtext -lwxbase30u_net -lwxmsw30u_propgrid -lwxmsw30u_media -lwxmsw30u_aui -lwxmsw30u_html -lwxmsw30u_adv -lwxbase30u_xml -lwxmsw30u_core -lwxbase30u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lwxscintilla -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 


C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filename.o):filename.cpp:(.text+0x273e): undefined reference to `wxMSLU__wchmod(wchar_t const*, int)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filename.o):filename.cpp:(.text+0x13c): undefined reference to `wxMSLU__wopen(wchar_t const*, int, int)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filefn.o):filefn.cpp:(.text+0x803a): undefined reference to `wxMSLU__wremove(wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filefn.o):filefn.cpp:(.text+0x9d4e): undefined reference to `wxMSLU__wrename(wchar_t const*, wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filefn.o):filefn.cpp:(.text+0xb257): undefined reference to `wxMSLU__wmkdir(wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_filefn.o):filefn.cpp:(.text+0xc0d7): undefined reference to `wxMSLU__wrmdir(wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_ffile.o):ffile.cpp:(.text+0x6d4e): undefined reference to `wxMSLU__wfopen(wchar_t const*, wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_file.o):file.cpp:(.text+0x166): undefined reference to `wxMSLU__waccess(wchar_t const*, int)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_file.o):file.cpp:(.text+0x1fb3): undefined reference to `wxMSLU__wopen(wchar_t const*, int, int)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_file.o):file.cpp:(.text+0x2dd5): undefined reference to `wxMSLU__wopen(wchar_t const*, int, int)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_file.o):file.cpp:(.text+0x3ce4): undefined reference to `wxMSLU__wremove(wchar_t const*)'
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxbase30u.a(baselib_file.o):file.cpp:(.text+0x5985): undefined reference to `wxMSLU__wremove(wchar_t const*)'
collect2.exe: error: ld returned 1 exit status

After that, I've tried compile the minimal example (command: mingw32-make -f makefile.gcc CXXFLAGS=-std=c+ +11) and I've got a similar message:

g++ -c -o gcc_mswud\minimal_minimal.o -g -O0 -mthreads  -DHAVE_W32API_H -D__WXMS
W__       -D_UNICODE  -I.\..\..\lib\gcc_lib\mswud -I.\..\..\include  -W -Wall -I
.  -I.\..\..\samples -DNOPCH   -Wno-ctor-dtor-privacy  -std=c++11 -MTgcc_mswud\m
inimal_minimal.o -MFgcc_mswud\minimal_minimal.o.d -MD -MP minimal.cpp
g++ -o gcc_mswud\minimal.exe gcc_mswud\minimal_sample_rc.o gcc_mswud\minimal_min
imal.o  -g -mthreads -L.\..\..\lib\gcc_lib -Wl,--subsystem,windows -mwindows
-lwxmsw30ud_core  -lwxbase30ud    -lwxtiffd -lwxjpegd -lwxpngd   -lwxzlibd -lwxr
egexud -lwxexpatd    -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -
lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwi
ninet
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filefn.o): In function `wxRemove(wxS
tring const&)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/wxcrt.h:758: undefined reference t
o `wxMSLU__wremove(wchar_t const*)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filefn.o): In function `wxRename(wxS
tring const&, wxString const&)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/wxcrt.h:760: undefined reference t
o `wxMSLU__wrename(wchar_t const*, wchar_t const*)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filefn.o): In function `wxRmDir(wxSt
ring const&)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:524: undefined reference
to `wxMSLU__wrmdir(wchar_t const*)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filefn.o): In function `wxMkDir(wxSt
ring const&, unsigned short)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:528: undefined reference
to `wxMSLU__wmkdir(wchar_t const*)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filename.o): In function `wxChmod(wx
String const&, unsigned short)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:513: undefined reference
to `wxMSLU__wchmod(wchar_t const*, int)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filename.o): In function `wxOpen(wxS
tring const&, int, unsigned short)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:515: undefined reference
to `wxMSLU__wopen(wchar_t const*, int, int)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_file.o): In function `wxAccess(wxStr
ing const&, unsigned short)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:511: undefined reference
to `wxMSLU__waccess(wchar_t const*, int)'
.\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_ffile.o): In function `wxFopen(wxStr
ing const&, wxString const&)':
C:\wxWidgets-3.0.2\build\msw/../../include/wx/wxcrt.h:754: undefined reference t
o `wxMSLU__wfopen(wchar_t const*, wchar_t const*)'
collect2.exe: error: ld returned 1 exit status
makefile.gcc:231: recipe for target 'gcc_mswud\minimal.exe' failed
mingw32-make: *** [gcc_mswud\minimal.exe] Error 1



Can anyone give me a hand with this? 

Thank you

lc

unread,
Mar 17, 2015, 8:15:13 AM3/17/15
to wx-u...@googlegroups.com

Igor Korot

unread,
Mar 17, 2015, 8:30:24 AM3/17/15
to wx-u...@googlegroups.com
Hi,

On Tue, Mar 17, 2015 at 7:27 AM, lc <car...@gmail.com> wrote:
> Hi all,
>
> I'm using wxWidgets with MinGW/TDM since wx version 2.8, almost without any
> problems.
>
> Yesterday I downloaded the last version of TDM and wxWidgets to compile my
> project, and since then I'm having some problems. I always built the library
> with the commands:
>
> mingw32-make -f makefile.gcc BUILD=debug SHARED=0 UNICODE=1
> mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1
>
> This time it doesn't work. It complained about the C++11. So I've changed to
> the following and it worked.

Could you post the error message?
Code should compile cleanly in non-C++11 mode...

Thank you.
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+u...@googlegroups.com
> or visit http://groups.google.com/group/wx-users

Vadim Zeitlin

unread,
Mar 17, 2015, 8:44:47 AM3/17/15
to wx-u...@googlegroups.com
On Tue, 17 Mar 2015 04:27:58 -0700 (PDT) lc wrote:

l> Yesterday I downloaded the last version of TDM and wxWidgets to compile my
l> project, and since then I'm having some problems. I always built the
l> library with the commands:
l>
l> mingw32-make -f makefile.gcc BUILD=debug SHARED=0 UNICODE=1
l> mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1
l>
l> This time it doesn't work.

Sorry but you need to give us more details. wxWidgets 3.0.2 is definitely
supposed to build using C++98 compiler.

l> It complained about the C++11. So I've changed
l> to the following and it worked.
l>
l> C:\wxWidgets-3.0.2\build\msw>mingw32-make -f makefile.gcc BUILD=debug
l> SHARED=0 UNICODE=1 CXXFLAGS=-std=c++11 -Wall
l> C:\wxWidgets-3.0.2\build\msw>mingw32-make -f makefile.gcc BUILD=release
l> SHARED=0 UNICODE=1 CXXFLAGS=-std=c++11 -Wall
...
l> After that, I've tried compile the minimal example (command: mingw32-make
l> -f makefile.gcc CXXFLAGS=-std=c+ +11) and I've got a similar message:
...
l> .\..\..\lib\gcc_lib/libwxbase30ud.a(baselib_filefn.o): In function
l> `wxRemove(wxString const&)':
l> C:\wxWidgets-3.0.2\build\msw/../../include/wx/wxcrt.h:758: undefined
l> reference to `wxMSLU__wremove(wchar_t const*)'
...
l> Can anyone give me a hand with this?

It's probably the same problem as http://trac.wxwidgets.org/ticket/15793
and we still don't have any good solution for it. The workaround is, as
mentioned there, to use -std=gnu++11 instead of -std=c++11.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

lc

unread,
Mar 17, 2015, 9:44:57 AM3/17/15
to wx-u...@googlegroups.com
Thank's Vadim and Igor for ther response.

The error message when I tried to build wxWidgets with mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 is

g++ -c -o gcc_mswu\baselib_dummy.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__
 -DNDEBUG    -D_UNICODE  -I..\..\lib\gcc_lib\mswu -I..\..\include  -W -Wall -DWX
BUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\z
lib -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 -DwxUSE_BASE=1   -Wno-
ctor-dtor-privacy   -MTgcc_mswu\baselib_dummy.o -MFgcc_mswu\baselib_dummy.o.d -M
D -MP ../../src/common/dummy.cpp
g++ -c -o gcc_mswu\baselib_any.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -
DNDEBUG    -D_UNICODE  -I..\..\lib\gcc_lib\mswu -I..\..\include  -W -Wall -DWXBU
ILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zli
b -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 -DwxUSE_BASE=1   -Wno-ct
or-dtor-privacy   -MTgcc_mswu\baselib_any.o -MFgcc_mswu\baselib_any.o.d -MD -MP
../../src/common/any.cpp
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++
/type_traits:35:0,
                 from ..\..\include/wx/strvararg.h:25,
                 from ..\..\include/wx/string.h:46,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/c++0x_warning.h:
32:2: error: #error This file requires compiler and library support for the ISO
C++ 2011 standard. This support is currently experimental, and must be enabled w
ith the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from ..\..\include/wx/string.h:46:0,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
..\..\include/wx/strvararg.h:350:18: error: 'is_enum' in namespace 'std' does no
t name a template type
     typedef std::is_enum<T> is_enum;
                  ^
..\..\include/wx/strvararg.h:354:54: error: 'is_enum' was not declared in this s
cope
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                      ^
..\..\include/wx/strvararg.h:354:68: error: template argument 1 is invalid
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                    ^
makefile.gcc:11712: recipe for target 'gcc_mswu\baselib_any.o' failed
mingw32-make: *** [gcc_mswu\baselib_any.o] Error 1


Vadim Zeitlin

unread,
Mar 17, 2015, 10:01:32 AM3/17/15
to wx-u...@googlegroups.com
On Tue, 17 Mar 2015 06:44:57 -0700 (PDT) lc wrote:

l> The error message when I tried to build wxWidgets with mingw32-make -f
l> makefile.gcc BUILD=release SHARED=0 UNICODE=1 is
...
l> In file included from
l> C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++
l> /type_traits:35:0,
l> from ..\..\include/wx/strvararg.h:25,
l> from ..\..\include/wx/string.h:46,
l> from ..\..\include/wx/any.h:19,
l> from ../../src/common/any.cpp:18:
l> C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/c++0x_warning.h:
l> 32:2: error: #error This file requires compiler and library support for the
l> ISO C++ 2011 standard. This support is currently experimental, and must
l> be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Thanks, so the problem is that HAVE_TYPE_TRAITS is defined, but the
compiler refuses to compile <type_traits> in non-C++11 mode. What I still
don't understand is how is it getting defined in the first place: it isn't
for me with gcc 4.9.1 (which also compiles any.cpp without any errors), so
I wonder if g++ added __has_include support in 4.9.2, resulting in
HAVE_TYPE_TRAITS being defined in wx/defs.h now.

Could you please check if this is the case? The simplest way to do it
would be to add -DHAVE_TYPE_TRAITS=17 to the compilation command line, you
should then get a warning about HAVE_TYPE_TRAITS being redefined with the
location of the place where this happens.

Thanks,

lc

unread,
Mar 17, 2015, 10:31:37 AM3/17/15
to wx-u...@googlegroups.com
OK, I'll try this. But where should I set HAVE_TYPE_TRAITS? I tried to append  in the command, but gcc  doesn't recognize it:

mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 -DHAVE_TYPE_TRAITS=17

I also tried 
mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 -D HAVE_TYPE_TRAITS=17

and
mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 --debug HAVE_TYPE_TRAITS=17

but I don't received any usefull information (or I don't know where to look at).

Thanks

Vadim Zeitlin

unread,
Mar 17, 2015, 10:35:40 AM3/17/15
to wx-u...@googlegroups.com
On Tue, 17 Mar 2015 07:31:36 -0700 (PDT) lc wrote:

l> OK, I'll try this. But where should I set HAVE_TYPE_TRAITS? I tried to
l> append in the command, but gcc doesn't recognize it:
l>
l> mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1
l> -DHAVE_TYPE_TRAITS=17

This is not gcc command line, this is make command line. I meant to just
copy and paste the gcc command line shown in your make output and append
-DHAVE_TYPE_TRAITS=17 to it. But you can also do it on make command line,
except in this case you need to use CPPFLAGS="-DHAVE_TYPE_TRAITS=17".

Regards,

lc

unread,
Mar 17, 2015, 4:37:50 PM3/17/15
to wx-u...@googlegroups.com
Vadim,

here is the complete output of the command:

C:\wx-3.0.2\build\msw>g++ -c -o gcc_mswu\baselib_any.o  -O2 -mthreads  -DHAVE_W3
2API_H -D__WXMSW__   -DNDEBUG -DHAVE_TYPE_TRAITS=17   -D_UNICODE  -I..\..\lib\gc
c_lib\mswu -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\
..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat
\lib -DwxUSE_GUI=0 -DwxUSE_BASE=1   -Wno-ctor-dtor-privacy -DHAVE_TYPE_TRAITS=17
  -MTgcc_mswu\baselib_any.o -MFgcc_mswu\baselib_any.o.d -MD -MP ../../src/common
/any.cpp
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++
/type_traits:35:0,
                 from ..\..\include/wx/strvararg.h:25,
                 from ..\..\include/wx/string.h:46,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/c++0x_warning.h:
32:2: error: #error This file requires compiler and library support for the ISO
C++ 2011 standard. This support is currently experimental, and must be enabled w
ith the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from ..\..\include/wx/string.h:46:0,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
..\..\include/wx/strvararg.h:350:18: error: 'is_enum' in namespace 'std' does no
t name a template type
     typedef std::is_enum<T> is_enum;
                  ^
..\..\include/wx/strvararg.h:354:54: error: 'is_enum' was not declared in this s
cope
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                      ^
..\..\include/wx/strvararg.h:354:68: error: template argument 1 is invalid
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                    ^

In this site, someone said that __has_include is defined in gcc-4.9-branch: 

Regards

Vadim Zeitlin

unread,
Mar 17, 2015, 7:40:30 PM3/17/15
to wx-u...@googlegroups.com
On Tue, 17 Mar 2015 13:37:50 -0700 (PDT) lc wrote:

l> here is the complete output of the command:

Sorry, while trying to understand why no warning appeared, I realized that
we have a guard checking whether HAVE_TYPE_TRAITS is already defined, so it
couldn't have worked :-(

l> In this site, someone said that __has_include is defined in gcc-4.9-branch:
l> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662

So this really must be why HAVE_TYPE_TRAITS is getting defined, I don't
see how else could this happen anyhow.

Anyhow, I've download TDM 4.9.2 now and I do see the problem. I think I've
fixed it now in 4f846f7, let's see if this doesn't break something else
before backporting it to 3.0...

AsmWarrior

unread,
Sep 27, 2015, 1:44:29 AM9/27/15
to wx-users


Same issue happens here when I try to use the mingw-build gcc 5.2 to build wxWidgets 3.0.2, see my report here:
Build C::B against wx3.02 with gcc 5.2 under Windows -
http://forums.codeblocks.org/index.php/topic,20607.msg140163.html#msg140163

I need to backport the patch you mentioned here on the wxWidgets 3.0.2 release under Windows:
Don't attempt using <type_traits> with g++ 4.9.2 in C++98 mode. · wxWidgets/wxWidgets@4f846f7 -
https://github.com/wxWidgets/wxWidgets/commit/4f846f72de795b86d8de0990dc3c340d30722a0e

Asmwarrior
 

Vadim Zeitlin

unread,
Sep 27, 2015, 5:52:45 AM9/27/15
to wx-u...@googlegroups.com
On Sat, 26 Sep 2015 22:44:28 -0700 (PDT) AsmWarrior wrote:

A> I need to backport the patch you mentioned here on the wxWidgets 3.0.2
A> release under Windows:
A> Don't attempt using <type_traits> with g++ 4.9.2 in C++98 mode. ·
A> wxWidgets/wxWidgets@4f846f7 -
A> https://github.com/wxWidgets/wxWidgets/commit/4f846f72de795b86d8de0990dc3c340d30722a0e

This was already backported as 2632977f6b6aa2f5c6254a69936ca288ace0560d
and will be part of 3.0.3 when it finally happens.
Reply all
Reply to author
Forward
0 new messages