Installing wxwidgets on Windows

670 views
Skip to first unread message

Andre F

unread,
Jan 11, 2022, 1:12:41 PM1/11/22
to wx-users

I've been trying to compile wxWidgets(for c++) on Window 10 home & pro machines with zero luck!! I
tried various things on 2 separate computers with various versions 3.1.5, 3.0.5 & 2.8.12!  I would have thought the install would be easier on windows, WOW was I wrong. I was able to get it working on Linux in minutes.

I installed both:
msys2-x86_64-20211130
mingw-get-setup

I created the folders wx and msw-build and copied the contents of wxWidgets over.  Up to this point seems to be OK, because I'm pretty sure none of the compile stuff would work otherwise.

Method #1
../configure --with-msw --build=x86-winnt-mingw64 --disable-shared --disable-threads
make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0

Method #2
../configure -q --with-msw --disable-debug --disable-debug_gdb --disable-shared --enable-stl --with-opengl --enable-std_string --enable-std_iostreams
make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0

error's occur either way, but method#2 seemed to go a lot further before an error popped up!

The latest error(method #2):
../src/msw/mediactrl_am.cpp: In member function 'void wxAMMediaEvtHandler::OnActivex(wxActivexEvents&)';
../src/msw/mediactrl_am.cpp:2234:10: error: narrowing conversion of '4294966687' from 'unsigned int' to 'long int' [-Wnarrowing]
case 0xfffffd9f: // readystatechange in IActiveMovie2 and IMediaPlayer

I looked up the switches being used and I'm not sure what to do at this point.  I've tried compiling with many variations of the above methods(adding and removing switches).  Nothing seems to make a difference.

Can someone please provide bungle proof instructions on how to install it?  I've been coding using wxWidgets via debian and it's nice, but so far I can't even get it installed on windows!  Installation is supposed to be the easy part and even more so when it comes to Windows.

Regards,
Frustrated WxUser

Igor Korot

unread,
Jan 11, 2022, 1:27:03 PM1/11/22
to wx-u...@googlegroups.com
Hi,

On Tue, Jan 11, 2022 at 12:12 PM Andre F <af68...@gmail.com> wrote:
>
>
> I've been trying to compile wxWidgets(for c++) on Window 10 home & pro machines with zero luck!! I
> tried various things on 2 separate computers with various versions 3.1.5, 3.0.5 & 2.8.12! I would have thought the install would be easier on windows, WOW was I wrong. I was able to get it working on Linux in minutes.
>
> I installed both:
> msys2-x86_64-20211130
> mingw-get-setup
>
> I created the folders wx and msw-build and copied the contents of wxWidgets over. Up to this point seems to be OK, because I'm pretty sure none of the compile stuff would work otherwise.
>
> Method #1
> ../configure --with-msw --build=x86-winnt-mingw64 --disable-shared --disable-threads
> make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0
>
> Method #2
> ../configure -q --with-msw --disable-debug --disable-debug_gdb --disable-shared --enable-stl --with-opengl --enable-std_string --enable-std_iostreams
> make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0

Is there a reason you didn't supply "--enable-monolithic" to configure?

Speaking of "MONOLITHIC" - what is the reason you want it?
You will not gain anything by using it and its possible you could lose some. ;-)

Just try to do simple "make -j3" without any other arguments.

Other than that - you could also try to build it with direct MinGW (no msys):

- Open Windows Terminal
- cd wxWidgets-3.1.5\build\msw
- mingw32 -f makefile.gcc DEBUG=0 SHARED=0 {MONOLITHIC=1}

Or you could try to install a free version of MSVC and build it with
MS product.

Thank yuu.

>
> error's occur either way, but method#2 seemed to go a lot further before an error popped up!
>
> The latest error(method #2):
> ../src/msw/mediactrl_am.cpp: In member function 'void wxAMMediaEvtHandler::OnActivex(wxActivexEvents&)';
> ../src/msw/mediactrl_am.cpp:2234:10: error: narrowing conversion of '4294966687' from 'unsigned int' to 'long int' [-Wnarrowing]
> case 0xfffffd9f: // readystatechange in IActiveMovie2 and IMediaPlayer
>
> I looked up the switches being used and I'm not sure what to do at this point. I've tried compiling with many variations of the above methods(adding and removing switches). Nothing seems to make a difference.
>
> Can someone please provide bungle proof instructions on how to install it? I've been coding using wxWidgets via debian and it's nice, but so far I can't even get it installed on windows! Installation is supposed to be the easy part and even more so when it comes to Windows.
>
> Regards,
> Frustrated WxUser
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/42bb3c26-e442-461c-b1d4-58d3082983f0n%40googlegroups.com.\build

Vadim Zeitlin

unread,
Jan 11, 2022, 3:03:17 PM1/11/22
to wx-u...@googlegroups.com
On Tue, 11 Jan 2022 10:09:30 -0800 (PST) Andre F wrote:

AF> I've been trying to compile wxWidgets(for c++) on Window 10 home & pro
AF> machines with zero luck!! I tried various things on 2 separate
AF> computers with various versions 3.1.5, 3.0.5 & 2.8.12!

Please forget about 2.8.12, it's 10+ years old and there is really no
possible scenario in which you would need it if you're just starting with
wx.

AF> Method #1
AF> ../configure --with-msw --build=x86-winnt-mingw64 --disable-shared
AF> --disable-threads
AF> make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0
AF>
AF> Method #2
AF> ../configure -q --with-msw --disable-debug --disable-debug_gdb
AF> --disable-shared --enable-stl --with-opengl --enable-std_string
AF> --enable-std_iostreams
AF> make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0
AF>

Both of those use a weird mix of non-default options and make variables,
why exactly did you decide to do it like this? Our documentation at

https://docs.wxwidgets.org/trunk/plat_msw_install.html#msw_build_mingw

gives much simpler commands:

$ ../configure --enable-debug
$ make

that really ought to work out of the box. Of course, most of the options
you've used are actually harmless, but I have doubts about some of them,
e.g. --build option value seems invalid and I don't know how does configure
handle it. You also most definitely shouldn't define any variables on make
command line when using configure.

AF> The latest error(method #2):
AF> ../src/msw/mediactrl_am.cpp: In member function 'void
AF> wxAMMediaEvtHandler::OnActivex(wxActivexEvents&)';
AF> ../src/msw/mediactrl_am.cpp:2234:10: error: narrowing conversion of
AF> '4294966687' from 'unsigned int' to 'long int' [-Wnarrowing]
AF> case 0xfffffd9f: // readystatechange in IActiveMovie2 and IMediaPlayer

This is not an error or, rather, it's only an error if you use -Werror.
It is a warning and one that should have been fixed by fd81223a2f (Fix
c++11-narrowing error when using clang on Windows, 2018-08-16) and so
shouldn't occur in 3.1.5. So while I have no idea what exactly is happening
on your machine, you clearly are not building 3.1.5 with the options above
(because they don't include -Werror anywhere).

AF> I looked up the switches being used and I'm not sure what to do at this
AF> point. I've tried compiling with many variations of the above
AF> methods(adding and removing switches). Nothing seems to make a difference.

You really shouldn't try to randomly add options without understanding
what do they do.

AF> Can someone please provide bungle proof instructions on how to install it?

See the URL above. Please entirely delete your build directory, run
configure without any options except those that you really need (e.g. you
can use --disable-shared if you need static libraries, of course) and then
just make.

AF> I've been coding using wxWidgets via debian and it's nice

You can also cross-compile wxMSW from Debian if you're feeling more
comfortable there.

Regards,
VZ

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

Andre F

unread,
Jan 11, 2022, 3:04:15 PM1/11/22
to wx-u...@googlegroups.com
To be honest, I didn't really know the pro's & con's of monolith.  I found it on a blog somewhere and it didn't sound bad when I looked it up.  I will try your suggestion and get back to you. 

Thanks for the prompt response!!!

Andre F

unread,
Jan 11, 2022, 9:17:52 PM1/11/22
to wx-u...@googlegroups.com

Thank you for all the assistance!  I was able to get it working via both the methods provided:
#1  mingw32 -f makefile.gcc DEBUG=0 SHARED=0 {MONOLITHIC=1

Do you know the compile command line to get the sample code working as a standalone windows .exe app?
g++ main.cpp `wx-config --cxxflags --libs` -o jlang.exe

Currently I can only run it inside of msys via the command line, but I would like to be able to DOUBLE CLICK it anywhere. The actual program is all std libs other than wxwidgets.

I'm happy I can at least run it on windows, but I would like to be able to double click it from the desktop!

Regards

Igor Korot

unread,
Jan 11, 2022, 9:35:40 PM1/11/22
to wx-u...@googlegroups.com
Hi,

On Tue, Jan 11, 2022 at 8:17 PM Andre F <af68...@gmail.com> wrote:
>
>
> Thank you for all the assistance! I was able to get it working via both the methods provided:
> #1 mingw32 -f makefile.gcc DEBUG=0 SHARED=0 {MONOLITHIC=1
> #2 https://docs.wxwidgets.org/trunk/plat_msw_install.html#msw_build_mingw
>
> Do you know the compile command line to get the sample code working as a standalone windows .exe app?
> g++ main.cpp `wx-config --cxxflags --libs` -o jlang.exe
>
> Currently I can only run it inside of msys via the command line, but I would like to be able to DOUBLE CLICK it anywhere. The actual program is all std libs other than wxwidgets.
>
> I'm happy I can at least run it on windows, but I would like to be able to double click it from the desktop!

What is happening when you do that?
Do you get any kind of error? Or nothing at all?

Thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CANdLyG2PtLSJvUM_Dtq-40kB3NzvNOog9xgA3uF6ZDW2GLdQPg%40mail.gmail.com.

Andre F

unread,
Jan 11, 2022, 10:25:15 PM1/11/22
to wx-u...@googlegroups.com

It finishes error free.

Regards

Andre F

unread,
Jan 11, 2022, 10:45:01 PM1/11/22
to wx-u...@googlegroups.com

When I type:  ./jlang.exe it runs without any issues.  This is the sample "hello World" wxwidget program from the website.

When you double click it, several popups come up stating that it can't find the following dll's and reinstalling blah blah blah.

wxbase315u_gcc_custom.dll
libgcc_s_seh-1.dll
wxmsw315u_core_gcc_custom.dll

Regards,
cmp_smpl.png

Igor Korot

unread,
Jan 11, 2022, 11:49:10 PM1/11/22
to wx-u...@googlegroups.com
Hi,

On Tue, Jan 11, 2022 at 9:45 PM Andre F <af68...@gmail.com> wrote:
>
>
> When I type: ./jlang.exe it runs without any issues. This is the sample "hello World" wxwidget program from the website.
>
> When you double click it, several popups come up stating that it can't find the following dll's and reinstalling blah blah blah.
>
> wxbase315u_gcc_custom.dll
> libgcc_s_seh-1.dll
> wxmsw315u_core_gcc_custom.dll

OK, so lets resolve these.
How did you compile wxWidgets and your application?
(please give an exact command for both).

Also make sure you can successfully compile and run minimal sample
provided by wxWidgets.

Thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CANdLyG2SZG_9%3DsqhiXJCfO-BJKa2rJ7Tr7%3DZbi7LLujBN3gNEw%40mail.gmail.com.

Andre F

unread,
Jan 12, 2022, 12:06:11 AM1/12/22
to wx-u...@googlegroups.com

The app is the wxwidget's sample hello world app, copied and pasted from the website.

This above link is how I configured it.  I copied wxwidget's to c:.  Then I opened msys64 and changed directory to wxwidgets, created the folder build-debug. changed directory into the build-debug directory and did the following.
 
$ ../configure --enable-debug
$ make
$ cd samples/minimal/
$ make
$ make install
$ g++ main.cpp `wx-config --cxxflags --libs` -o jlang.exe

Regards

Igor Korot

unread,
Jan 12, 2022, 12:29:50 AM1/12/22
to wx-u...@googlegroups.com
Hi,

On Tue, Jan 11, 2022 at 11:06 PM Andre F <af68...@gmail.com> wrote:
>
>
> https://docs.wxwidgets.org/trunk/overview_helloworld.html
> The app is the wxwidget's sample hello world app, copied and pasted from the website.
>
> https://docs.wxwidgets.org/trunk/plat_msw_install.html#msw_build_mingw
> This above link is how I configured it. I copied wxwidget's to c:. Then I opened msys64 and changed directory to wxwidgets, created the folder build-debug. changed directory into the build-debug directory and did the following.
>
> $ ../configure --enable-debug
> $ make

What happens if you do "make install" here instead?

> $ cd samples/minimal/
> $ make

What happen if you open that folder in the WE and double click
on the executable?

Now I'm not sure but it's possible that since you are building
*nix style it creates a dynamic build by default.

> $ make install
> $ g++ main.cpp `wx-config --cxxflags --libs` -o jlang.exe

> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CANdLyG3adyH6zmaN64wafozv%2BBMeuWieZm%2BUeLDtxHVAieCsgg%40mail.gmail.com.

Andre F

unread,
Jan 12, 2022, 12:55:08 AM1/12/22
to wx-u...@googlegroups.com
I'm not sure what the WE is.  I haven't used windows in quite a while, but I have tried double clicking it from the file explorer window.  I tried and it didn't work.  If you meant something else, please let me know.

Regards,

Igor Korot

unread,
Jan 12, 2022, 1:23:48 AM1/12/22
to wx-u...@googlegroups.com
Hi,

On Tue, Jan 11, 2022 at 11:55 PM Andre F <af68...@gmail.com> wrote:
>
> I'm not sure what the WE is. I haven't used windows in quite a while, but I have tried double clicking it from the file explorer window. I tried and it didn't work. If you meant something else, please let me know.
>
> Regards,
>
> On Tue, Jan 11, 2022 at 11:29 PM Igor Korot <ikor...@gmail.com> wrote:
>>
>> Hi,
>>
>> On Tue, Jan 11, 2022 at 11:06 PM Andre F <af68...@gmail.com> wrote:
>> >
>> >
>> > https://docs.wxwidgets.org/trunk/overview_helloworld.html
>> > The app is the wxwidget's sample hello world app, copied and pasted from the website.
>> >
>> > https://docs.wxwidgets.org/trunk/plat_msw_install.html#msw_build_mingw
>> > This above link is how I configured it. I copied wxwidget's to c:. Then I opened msys64 and changed directory to wxwidgets, created the folder build-debug. changed directory into the build-debug directory and did the following.
>> >
>> > $ ../configure --enable-debug

Try to do the following
Remove the build-debg directory and create it again.
switch to it
Do "../configure --enable-debug --disable-shared"
make
cd samples/minimal
make

Try to run by double-clicking it in the WE (Windows Explorer).
Or File Explorer as you call it.

That configure line will ensure that the build will be static and not
dynamic.

Thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CANdLyG3zOCzjki5%3DyYw%2BRQ_oYV%2BDpADqcqf19hHZ-kzyanhtiw%40mail.gmail.com.

QuentinC

unread,
Jan 12, 2022, 1:33:36 AM1/12/22
to wx-u...@googlegroups.com
Hello,

I just came through your messages. If you want to run the examples, you
just need to copy the DLLS into the same directory as the executable you
want to run.

Alternatively, you can put the DLLs in windows directory or in another
directory that can be found in PATH, but it isn't recommanded because of
conflicts.

Vadim Zeitlin

unread,
Jan 12, 2022, 9:54:29 AM1/12/22
to wx-u...@googlegroups.com
On Wed, 12 Jan 2022 07:33:28 +0100 QuentinC wrote:

Q> I just came through your messages. If you want to run the examples, you
Q> just need to copy the DLLS into the same directory as the executable you
Q> want to run.

Thanks Quentin, this is the right answer and it has nothing to do with how
wx or your application was built, it's just how Windows DLLs work.

And while you can build wx statically, you're still going to have
dependencies on MinGW CRT DLLs, so you can just as well use wx as DLLs too
(or even use the binaries that we provide), because you will have to copy
some DLLs into your application directory anyhow.

Les Newell

unread,
Jan 12, 2022, 10:38:30 AM1/12/22
to wx-u...@googlegroups.com
I recently updated my version of wxWidgets to the latest master and I
now have an issue with wxTreeCtrl not displaying some images.

I have attached files to demonstrate the issue using the treectrl sample.

Apply the patch and place the png files in the executable's working
directory then run it. Select Style->toggle alternate images. Set
Style->image size to 32 to display the icons at original size. test2.png
(a parallelogram shape) displays correctly as the folder closed icon.
test.png (a rectangle shape) does not display as the folder open icon.

In my testing I saved the contents of the tree control's image list as
PNG files and they all came out correct so it's not a problem with
loading the files or storing them in a wxImageList.

3.1.5 works as expected. master does not. I have only tested on MSW.

Les

test2.png
test.png
treetest.patch

Igor Korot

unread,
Jan 12, 2022, 12:40:28 PM1/12/22
to wx-u...@googlegroups.com
Hi,
Are you using HighDPI monitor?
What resolution do you have for testing?

Thank you.

>
> 3.1.5 works as expected. master does not. I have only tested on MSW.
>
> Les
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/a6073538-497f-aff8-d01e-85b496b1a55c%40fastmail.co.uk.

Les Newell

unread,
Jan 12, 2022, 12:58:18 PM1/12/22
to wx-u...@googlegroups.com
I'm using two 1920x1080 monitors with 100% scaling.

By the way, I made a mistake on my previous report. The last version
that works correctly is 3.1.4. 3.1.5 and master do not.

Les

Igor Korot

unread,
Jan 12, 2022, 1:07:40 PM1/12/22
to wx-u...@googlegroups.com
Hi,

On Wed, Jan 12, 2022 at 11:58 AM Les Newell <les.n...@fastmail.co.uk> wrote:
>
> I'm using two 1920x1080 monitors with 100% scaling.
>
> By the way, I made a mistake on my previous report. The last version
> that works correctly is 3.1.4. 3.1.5 and master do not.

Can you try to do bisecting?

Thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/152e228c-d231-d506-f6af-69b313c249f1%40fastmail.co.uk.

Les Newell

unread,
Jan 12, 2022, 1:20:32 PM1/12/22
to wx-u...@googlegroups.com
Bisecting may take a while. I'll have a go tomorrow. I just tried under
Linux/GTK3 and again 3.1.4 works and 3.1.5 does not. At least we now
know it's not a Windows specific issue.

Les

Andre F

unread,
Jan 12, 2022, 4:24:06 PM1/12/22
to wx-u...@googlegroups.com
Thank you for your assistance.  Resolved!


Les Newell

unread,
Jan 13, 2022, 10:03:45 AM1/13/22
to wx-u...@googlegroups.com
Well, that was tedious...
On linux the problem appears to be triggered by commit
838e45fd9b58392df0936cfb2bfd19bf95d1645d Fix adding wxBitmap to generic
wxImageList supporting masks. I think msw has a different implementation
of wxImageList.

I think there is actually something funky going on with alpha channel
conversion. In my initial testing I noticed that if I load the png file
into a wxBitmap then save it as a bmp file I just get a solid black image.

I will do some more testing  and see what I can come up with.

Les

Vadim Zeitlin

unread,
Jan 13, 2022, 10:35:12 PM1/13/22
to wx-u...@googlegroups.com
On Thu, 13 Jan 2022 15:03:32 +0000 Les Newell wrote:

LN> Well, that was tedious...
LN> On linux the problem appears to be triggered by commit
LN> 838e45fd9b58392df0936cfb2bfd19bf95d1645d Fix adding wxBitmap to generic
LN> wxImageList supporting masks.

Thanks for finding this!

LN> I think msw has a different implementation of wxImageList.

Yes, wxMSW uses native API.

LN> I think there is actually something funky going on with alpha channel
LN> conversion. In my initial testing I noticed that if I load the png file
LN> into a wxBitmap then save it as a bmp file I just get a solid black image.

This is because all of the pixels of this image are black, only the alpha
channel value differs between them. I have no idea how is this supposed to
work, to be honest, but clearly this does not work with ConvertAlphaToMask()
used by the commit above.

I'm not sure if Artur is reading this, but I wonder if we really have to
convert alpha to mask here, it clearly results in loss of information, and
not just in this case -- but in this one, it loses *all* the information
about the image.

Les Newell

unread,
Jan 14, 2022, 8:22:18 AM1/14/22
to wx-u...@googlegroups.com
The equivalent in msw is this commit
[8f08233a1322283958b3097099f03bbc09b796b4] Fix adding wxBitmap with mask
to wxImageList not supporting masks (wxMSW)

Les

Vadim Zeitlin

unread,
Jan 17, 2022, 12:39:51 PM1/17/22
to wx-u...@googlegroups.com
On Fri, 14 Jan 2022 13:22:11 +0000 Les Newell wrote:

LN> The equivalent in msw is this commit
LN> [8f08233a1322283958b3097099f03bbc09b796b4] Fix adding wxBitmap with mask
LN> to wxImageList not supporting masks (wxMSW)

FWIW this is now tracked in https://github.com/wxWidgets/wxWidgets/issues/22021
and I hope we can do something about it before 3.1.6.

Thanks again for reporting this,

Les Newell

unread,
Jan 17, 2022, 1:12:49 PM1/17/22
to wx-u...@googlegroups.com
Thank you.

Les
Reply all
Reply to author
Forward
0 new messages