Using wxWidgets with MinGW and Code::Blocks

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
rocvan
Earned a small fee
Earned a small fee
Posts: 15
Joined: Sat May 14, 2022 6:42 am

Using wxWidgets with MinGW and Code::Blocks

Post by rocvan »

Hi,

Many thanks for your guide.

I have studied the guide and follow the step to build the wxWidgets in windows 10.

I am using the wxWidgets for MSYS2 (https://packages.msys2.org/package/ming ... po=mingw64).

My msys2 doesn't has the mingw32-make, only found the make.exe in C:\msys64\usr\bin
I have adjusted the cmd environment:
set PATH=c:\msys64\mingw64\bin;c:\msys64\usr\bin;%PATH%

I am not sure what has happened after execute the following command:
make -f makefile.gcc SHARED=1 BUILD=debug CXXFLAGS="-std=c++17"

The cmd.exe output as followed (I have tried to add SHELL=cmd.exe, same output):

if not exist gcc_mswuddll mkdir gcc_mswuddll
Microsoft Windows [Version 10.0.19044.1706]
(c) Microsoft Corporation. All rights reserved.

I cannot see any thing on screen and no any output in wxWidgets-3.1.6\lib
It is quite weird that the history in cmd is cleared.

How can I check the problem? Is there any reasons on this build failure?

Thanks again
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: Using wxWidgets with MinGW and Code::Blocks

Post by PB »

rocvan wrote: Sat May 14, 2022 10:53 pm I have studied the guide and follow the step to build the wxWidgets in windows 10.

I am using the wxWidgets for MSYS2 (https://packages.msys2.org/package/ming ... po=mingw64).
It seems you did not follow my guide but installed MSYS2 prebuilt wxWidgets instead. If you are using MSYS2 prebuilt wxWidgets, you cannot use my guide: (1) You do not have to build wxWidgets and (2) Code::Blocks wxWidgets project wizard does not work with wxWidgets MSYS2 package, as the MSYS2 library names use a different pattern than the libraries built with bundled makefile (e.g., libwx_baseu-3.0.a vs libwxbase30u.a) and the folder structure (include and library folders) is also different.
rocvan wrote: Sat May 14, 2022 10:53 pm My msys2 doesn't has the mingw32-make, only found the make.exe in C:\msys64\usr\bin
This is odd, did you install the actual compiler package as instructed in the guide, such as mingw-w64-x86_64-toolchain? Nevertheless, you do not / should not need build wxWidgets, you already have the prebuilt package.

AFAIK, in CodeLite v16, wxWidgets project template uses prebuilt MSYS2 wxWidgets package (via CodeLite's modified wx-config), so perhaps you wanted to used CodeLite?
rocvan
Earned a small fee
Earned a small fee
Posts: 15
Joined: Sat May 14, 2022 6:42 am

Re: Using wxWidgets with MinGW and Code::Blocks

Post by rocvan »

Many thanks for your reply.
(How to subscribe the reply by receiving email? I haven't realized that this thread has updated).
PB wrote: Sun May 15, 2022 7:46 am It seems you did not follow my guide but installed MSYS2 prebuilt wxWidgets instead. If you are using MSYS2 prebuilt wxWidgets, you cannot use my guide: (1) You do not have to build wxWidgets and (2) Code::Blocks wxWidgets project wizard does not work with wxWidgets MSYS2 package, as the MSYS2 library names use a different pattern than the libraries built with bundled makefile (e.g., libwx_baseu-3.0.a vs libwxbase30u.a) and the folder structure (include and library folders) is also different.
I found that MSYS2 does not contain the prebuilt wxWidgets dll. I downloaded the dll from wxWidgets and put all dlls (gcc810_x64_dll) under msys64\mingw64\lib\wx\lib\. It can build now.
PB wrote: Sun May 15, 2022 7:46 am This is odd, did you install the actual compiler package as instructed in the guide, such as mingw-w64-x86_64-toolchain? Nevertheless, you do not / should not need build wxWidgets, you already have the prebuilt package.
Yes, I have followed the guide, install the toolchain, only found "make" no other make exe file.
Original code is from QT ui, I only want to build the simple wxWidgets UI application, so I am not using codelite or visual studio 2022.

I am afraid CodeLite met same problem. Quite frustrated to change the environment, lack of experience on step by step to setup wxWidgets. Maybe try the CodeLite later.

Van
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Using wxWidgets with MinGW and Code::Blocks

Post by doublemax »

rocvan wrote: Fri May 20, 2022 7:32 am (How to subscribe the reply by receiving email? I haven't realized that this thread has updated).
User control panel -> Board preferences -> Edit notification options
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: Using wxWidgets with MinGW and Code::Blocks

Post by PB »

rocvan wrote: Fri May 20, 2022 7:32 am I found that MSYS2 does not contain the prebuilt wxWidgets dll.
In your first post, you wrote that you did install the prebuilt MSYS2 package and even provided the link to it?
rocvan wrote: Fri May 20, 2022 7:32 am I downloaded the dll from wxWidgets and put all dlls (gcc810_x64_dll) under msys64\mingw64\lib\wx\lib\. It can build now.
Are you sure you can use the binary built with GCC 8 with MSYS GCC which has GCC 11 (and probably different setup).
rocvan wrote: Fri May 20, 2022 7:32 am Yes, I have followed the guide, install the toolchain, only found "make" no other make exe file.
Original code is from QT ui, I only want to build the simple wxWidgets UI application, so I am not using codelite or visual studio 2022.

I am afraid CodeLite met same problem. Quite frustrated to change the environment, lack of experience on step by step to setup wxWidgets. Maybe try the CodeLite later.
Had you followed the guide, you would have installed the compiler toolchain (see Chapter 3.3) and had no issue like this? I also don't understand how CodeLite or MSVS are relevant here, nevertheless, usually an IDE is used for development. You cannot just switch an application from Qt to wxWidgets as you would switch a compiler.

IMO, building wxWidgets on Windows is very easy, as it has no external dependencies and it boils down to just downloading the source and running the make.

Similarly, setting up wxWidgets with Code::Blocks is simple too, both creating the project manually or using the wizard?

If one lacks experience, they should follow a tutorial, there are three listed in just this thread, there are also some on wxwiki and various other web pages...
rocvan
Earned a small fee
Earned a small fee
Posts: 15
Joined: Sat May 14, 2022 6:42 am

Re: Using wxWidgets with MinGW and Code::Blocks

Post by rocvan »

PB wrote: Fri May 20, 2022 9:05 am In your first post, you wrote that you did install the prebuilt MSYS2 package and even provided the link to it?
Yes, see my explanation below.
PB wrote: Fri May 20, 2022 9:05 am Had you followed the guide, you would have installed the compiler toolchain (see Chapter 3.3) and had no issue like this? I also don't understand how CodeLite or MSVS are relevant here, nevertheless, usually an IDE is used for development. You cannot just switch an application from Qt to wxWidgets as you would switch a compiler.
PB wrote: Fri May 20, 2022 9:05 am If one lacks experience, they should follow a tutorial, there are three listed in just this thread, there are also some on wxwiki and various other web pages...
Many thanks for your patient and guidance.

I have studied your guide and learned a lot of concept.

There is a wxWidgets package for MSYS2, so installed the wxWidgets package and try to build the helloworld (using cmake this time).

The problem is
(1) can build the helloworld in MSYS2, but cannot execute the helloworld.exe (a lot of alert on missing dll).

To fix the problem (1), I was wondering there maybe a problem on prebuilt binaries of wxWidgets for MSYS2. Then I have tried to follow the guide in this thread, step by step to install the toolchains, build the wxWidgets for MSYS2 then check any missing.

I have do the following steps:
a. download the wxWidgets 3.1.6
b. build the code in command prompt
c. followed the "3.5 Adding System Environment Variable WXWIN".
d. stuck with 3.6.1, I cannot build the wxWidgets using the commands in Listing 3-1


Finally, I found that wxWidgets has the guide to build the binary (also the help on the guide on setting up the WXWIN):

0. Open MSYS2 shell prompt.

1. Create a build directory: it is is strongly recommended to not
build the library in the directory containing the sources ($WXWIN)
but to create a separate build directory instead. The build
directory can be placed anywhere (using the fastest available disk
may be a good idea), but in this example we create it as a
subdirectory of the source one:

$ cd $WXWIN
$ mkdir build-debug

2. Run configure passing it any of the options shown by "configure
--help". Notice that configure builds shared libraries by default,
use --disable-shared to build static ones. For example:
$ ../configure --enable-debug

3. Build the library:
$ make

4. Test the library build by building the minimal sample:
$ cd samples/minimal
$ make

The minimal samples built successfully.

Recent found out:
(a) there is no "mingw32-make.exe" or "mingw64-make.exe", only has "make.exe" in C:\msys64\mingw64\bin
(b) Not sure the reason, but the helloworld.exe can execute now without alert.
(c) the gcc810_x64_dll is not related to the problem (1), even removed gcc810_x64_dll, there is no problem on build and execution.

Anyway, I can build the simple code (add sizer, add button) now.
Post Reply