Author Topic: How to create wxWidgets program for Windows 32 bit using codeblocks-20.03mingw?  (Read 5707 times)

Offline tumanovalex

  • Multiple posting newcomer
  • *
  • Posts: 23
I installed codeblocks-20.03mingw-setup on Windows 10 Home 64bit. I compiled wxWidgets with the commands:
mingw32-make -f makefile.gcc SHARED = 0 UNICODE = 1 BUILD = debug
mingw32-make -f makefile.gcc SHARED = 0 UNICODE = 1 BUILD = release
Then I released a version of the program with wxWidgets. With the m64 flag set, I was able to create different versions of the program (with the Static linking flag set and three static flags set. The program works fine in Windows 64 bit. When the m32 flag is set, errors occur (indicated only part of the errors):
Code
-windres.exe -ID: \ wxWid \ include -ID: \ wxWid \ lib \ gcc_lib \ mswu -J rc -O coff -i D: \ MyProgramming \ wxTestNew \ resource.rc -o obj \ Release \ resource.res
g ++. exe -Wall -m32 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -m32 -ID: \ wxWid \ include -ID: \ wxWid \ lib \ gcc_lib \ mswu -ID: \ wxWid \ lib \ gcc_ -ID: \ wxWid \ include -c D: \ MyProgramming \ wxTestNew \ wxTestNewApp.cpp -o obj \ Release \ wxTestNewApp.o
g ++. exe -Wall -m32 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -m32 -ID: \ wxWid \ include -ID: \ wxWid \ lib \ gcc_lib \ mswu -ID: \ wxWid \ lib \ gcc_ -ID: \ wxWid \ include -c D: \ MyProgramming \ wxTestNew \ wxTestNewMain.cpp -o obj \ Release \ wxTestNewMain.o
g ++. exe -LD: \ wxWid \ lib \ gcc_lib -o bin \ Release \ wxTestNew.exe obj \ Release \ wxTestNewApp.o obj \ Release \ wxTestNewMain.o obj \ Release \ resource.res -s -m32 -m32 -mthreads -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32llol -lllxlllclllclllcdlll -mwindows
D: / Program Files / CodeBlocks / MinGW / bin /../ lib / gcc / x86_64-w64-mingw32 / 8.1.0 /../../../../ x86_64-w64-mingw32 / bin / ld .exe: skipping incompatible D: \ wxWid \ lib \ gcc_lib / libwxmsw31u_core.a when searching for -lwxmsw31u_core
D: / Program Files / CodeBlocks / MinGW / bin /../ lib / gcc / x86_64-w64-mingw32 / 8.1.0 /../../../../ x86_64-w64-mingw32 / bin / ld .exe: skipping incompatible D: \ wxWid \ lib \ gcc_lib \ libwxmsw31u_core.a when searching for -lwxmsw31u_core
D: / Program Files / CodeBlocks / MinGW / bin /../ lib / gcc / x86_64-w64-mingw32 / 8.1.0 /../../../../ x86_64-w64-mingw32 / bin / ld .exe: skipping incompatible D: \ wxWid \ lib \ gcc_lib / libwxmsw31u_core.a when searching for -lwxmsw31u_core
D: / Program Files / CodeBlocks / MinGW / bin /../ lib / gcc / x86_64-w64-mingw32 / 8.1.0 /../../../../ x86_64-w64-mingw32 / bin / ld .exe: cannot find -lwxmsw31u_core
What needs to be done so that on a PC with Windows 64 bit and codeblocks-20.03mingw it is possible to create programs with wxWidgets for a PC with Windows 32 bits and Windows 64 bit?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Where are you setting the m32 flag while building wxWidgets?

Edit: Where/When are the errors happening? Inside Code::Blocks IDE or while building wxWidgets?

Tim S.
« Last Edit: April 18, 2020, 01:08:10 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
You need to build 32 bit wxWidgets libraries in order to build an 32 bit wxWidgets application.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
I see nothing that implies the 20.03 CB MinGW GCC fully supports 32 bit building.

It is not easy to do fully.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
I will try it and see if it works for me; I consider it unlikely to work.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
I will try it and see if it works for me; I consider it unlikely to work.

Tim S.

It was able to build the wxWidgets library; but, it could not build the minimal sample.
It was missing the 32 bit "msvcrt". Edit: This was just the last of many libraries it said it could not find.

Tim S.
« Last Edit: April 18, 2020, 07:35:45 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
32 bit build command used

Code
mingw32-make -f makefile.gcc CC="gcc -m32" CXX="g++ -m32" WINDRES="windres --use-temp-file -F pe-i386" CXXFLAGS+="-fno-keep-inline-dllexport -std=gnu++11" COMPILER_VERSION=810 MONOLITHIC=0 SHARED=0 UNICODE=1 BUILD=release

64 bit build command

Code
mingw32-make -f makefile.gcc CXXFLAGS+="-fno-keep-inline-dllexport -std=gnu++11" COMPILER_VERSION=810_x64 MONOLITHIC=0 SHARED=0 UNICODE=1 BUILD=release

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline tumanovalex

  • Multiple posting newcomer
  • *
  • Posts: 23
Thank you very much, I will try. I will inform you of the results. I am a novice user of CodeBlocks and wxWidgets, so it will take me some time to get the result.

Offline tumanovalex

  • Multiple posting newcomer
  • *
  • Posts: 23
I decided to check first the possibility of creating a console application for 32 and 64 bits. For 64 bits, everything works well, programs are created with static linking, which run without errors on Windows 64 bits. Installed in the settings project m32, gnu ++ 11. I got the same errors as in the application with wxWidgets. Please tell me how to configure a console project through the project settings (Project Build) in order to create a version for 32 bits.

Offline sodev

  • Regular
  • ***
  • Posts: 497
AFAIK the Mingw-w64 toolchains are not multilib, you need a complete toolchain for each architecture. I assume the package contains only one toolchain, the one CodeBlocks was build itself with, so this would be the 64 bit toolchain which cannot build 32 bit. You need to install the 32 bit toolchain yourself and point CodeBlocks to use that one to build for 32 bit.

Offline tumanovalex

  • Multiple posting newcomer
  • *
  • Posts: 23
Thank you very much for your reply. Apparently, I thought incorrectly that I can use version 20.03 for 32 bits as well.