[SOLVED] Just can't get it to work.. Topic is solved

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
PGU8
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue May 26, 2020 4:53 pm

[SOLVED] Just can't get it to work..

Post by PGU8 » Tue May 26, 2020 5:05 pm

I am trying to use wxwidget with codeblocks, I've followed all the tutorial out there and have spent hours of googling just trying to get it to work, I am using wxwidget 3.0 with the latest version of codeblocks, windows 10, desparate to get it to work..

I believe the problem lies on the linker stuff

Code: Select all

search directories > compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu
search directories > linker > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib
search directories > linker > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\include
search directories > resource compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu
the error:

Code: Select all

Files\||No such file or directory|
\(x86\)\CodeBlocks\wxWidgets-3.0.5\include||No such file or directory|
Files\||No such file or directory|
\(x86\)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu||No such file or directory|
extra changes I made:
when the first time I tried to compile, it says that in \wxWidgets-3.0.5\include\wx setup.h doesn't exist, so what I read some other post on this forum and took it from here wxWidgets-3.0.5\include\wx\msw and just paste it to the include\wx\

any help is appreciated, thanks..
Last edited by PGU8 on Wed May 27, 2020 11:41 am, edited 1 time in total.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4245
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Just can't get it to work..

Post by ONEEYEMAN » Tue May 26, 2020 5:48 pm

Hi,
Did you successfully build wxWidgets?
Did you successfully installed C::B?
If those answers are "yes" - did you successfully created the wxWidgets project inside C::B? If not - what happened?
Thank you.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Just can't get it to work..

Post by stahta01 » Tue May 26, 2020 6:48 pm

Code: Select all

search directories > compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu
search directories > linker > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib
search directories > linker > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\include
search directories > resource compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu
From memory the above is wrong.

This is what I think it should be

Code: Select all

search directories > compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib\mswu
search directories > compiler > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\include
search directories > linker > C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\lib\gcc_lib
search directories > resource compiler >  C:\Program Files (x86)\CodeBlocks\wxWidgets-3.0.5\include
Note: I would likely not wish to put wxWidgets under the CodeBlocks install folder; but, it is a better location than some that I have seen used.

Edit: The reason I would not do it is because some compilers have problems with spaces or non ASCII charactors in the project path and I would guess this problem also exists for the include path.

Tim S.

PGU8
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue May 26, 2020 4:53 pm

Re: Just can't get it to work..

Post by PGU8 » Wed May 27, 2020 9:48 am

@Tim S

thanks, the problem was the spaces in the path, now it gives me another error of -lwxmsw30u could not be found. I looked at the lib folder and the file doesn't even exist, it doesn't exist anywhere..

and for moderators, please whitelist my account, I've been trying to reply to this topic for hours and it keep getting the Forbidden spam stuff...

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

Re: Just can't get it to work..

Post by PB » Wed May 27, 2020 10:08 am

PGU8 wrote:
Wed May 27, 2020 9:48 am
now it gives me another error of -lwxmsw30u could not be found. I looked at the lib folder and the file doesn't even exist, it doesn't exist anywhere..
The name library indicates that the linker is expecting the Release version of the Monolithic build of the library (e.g., in C::B project wizard, you checked "wxWidgets is built as monolithic library").

When you built wxWidgets by yourself and did not specify you want Release and Monolithic, the default build is Debug and Multilib.
For example, this will produce Static Debug Multilib wxWidgets build

Code: Select all

mingw32-make -f makefile.gcc
and this will produce Static Release Monolithic build

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1
If you want to have Dynamic build (wxWidgets libraries are linked as DLLs), you need to add

Code: Select all

SHARED=1
to the build parameters

So, did you build Release Monolithic library or obtained it by any other means (the official binaries are Dynamic Release Multilib)?

PGU8
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue May 26, 2020 4:53 pm

Re: Just can't get it to work..

Post by PGU8 » Wed May 27, 2020 10:24 am

PB wrote:
Wed May 27, 2020 10:08 am
PGU8 wrote:
Wed May 27, 2020 9:48 am
now it gives me another error of -lwxmsw30u could not be found. I looked at the lib folder and the file doesn't even exist, it doesn't exist anywhere..
The name library indicates that the linker is expecting the Release version of the Monolithic build of the library (e.g., in C::B project wizard, you checked "wxWidgets is built as monolithic library").

When you built wxWidgets by yourself and did not specify you want Release and Monolithic, the default build is Debug and Multilib.
For example, this will produce Static Debug Multilib wxWidgets build

Code: Select all

mingw32-make -f makefile.gcc
and this will produce Static Release Monolithic build

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1
If you want to have Dynamic build (wxWidgets libraries are linked as DLLs), you need to add

Code: Select all

SHARED=1
to the build parameters

So, did you build Release Monolithic library or obtained it by any other means (the official binaries are Dynamic Release Multilib)?
I built with the exact code from this https://wiki.wxwidgets.org/Compiling_wx ... with_MinGW
it doesn't specifiy monolitic or not, is it monolithic by default? I also looked at prebuilt binary of wxwidget, there is no -lwxmsw30u either, I must be missing something

PGU8
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue May 26, 2020 4:53 pm

Re: Just can't get it to work..

Post by PGU8 » Wed May 27, 2020 11:11 am

PB wrote:
Wed May 27, 2020 10:08 am
PGU8 wrote:
Wed May 27, 2020 9:48 am
now it gives me another error of -lwxmsw30u could not be found. I looked at the lib folder and the file doesn't even exist, it doesn't exist anywhere..
The name library indicates that the linker is expecting the Release version of the Monolithic build of the library (e.g., in C::B project wizard, you checked "wxWidgets is built as monolithic library").

When you built wxWidgets by yourself and did not specify you want Release and Monolithic, the default build is Debug and Multilib.
For example, this will produce Static Debug Multilib wxWidgets build

Code: Select all

mingw32-make -f makefile.gcc
and this will produce Static Release Monolithic build

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1
If you want to have Dynamic build (wxWidgets libraries are linked as DLLs), you need to add

Code: Select all

SHARED=1
to the build parameters

So, did you build Release Monolithic library or obtained it by any other means (the official binaries are Dynamic Release Multilib)?
I decided to restart everything, here is my compile command:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 UNICODE=1 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 UNICODE=1 BUILD=release
The error (only 1):

Code: Select all

CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\libwxbase30u.a, No such file or directory
The library does not exist anywhere. It tries to look for a file that does not exist..

Codeblocks configuration:
-GUI builder = wxSmith
-Application Type = Dialog based

-Create Debug Configuration = not checked
-Create Release Configuration = checked (all default settings)

[true] use wxWidgets dll
[true] wxWidgets is built as monolithic library
[true] Enable Unicode
[false] Create Empty Project
[false] Create and use precompiled header (PCH)
[false] Configure advanced options

EDIT : got it working by replacing it by C:\CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\libwxmsw30u.a
Last edited by PGU8 on Wed May 27, 2020 6:00 pm, edited 1 time in total.

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

Re: Just can't get it to work..

Post by PB » Wed May 27, 2020 12:51 pm

PGU8 wrote:
Wed May 27, 2020 11:11 am

The error (only 1):

Code: Select all

CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\libwxbase30u.a, No such file or directory
The library does not exist anywhere. It tries to look for a file that does not exist..

Codeblocks configuration:
[true] wxWidgets is built as monolithic library
There must be something wrong with your Code::Blocks settings. When you use monolithic library, there is no "libwxbase30u.a", the only wxWidgets library is "libwxmsw30u.a". "libwxbase30u.a" exists only in the multilib build.

For example this is the content of Release Monolithic build, i.e. only two actual wxWidgets librariesy, the rest is the third party libraries (scinitilla, zip, regex and image formats):
libwxexpat.a
libwxjpeg.a
libwxmsw30u.a
libwxmsw30u_gl.a

libwxpng.a
libwxregexu.a
libwxscintilla.a
libwxtiff.a
libwxzlib.a

In the multilib build, there are many wxWidgets libraries, e.g. :
libwxbase30u.a
libwxbase30u_net.a
libwxbase30u_xml.a

libwxexpat.a
libwxjpeg.a
libwxmsw30u_adv.a
libwxmsw30u_aui.a
libwxmsw30u_core.a
libwxmsw30u_gl.a
libwxmsw30u_html.a
libwxmsw30u_media.a
libwxmsw30u_propgrid.a
libwxmsw30u_ribbon.a
libwxmsw30u_richtext.a
libwxmsw30u_stc.a
libwxmsw30u_webview.a
libwxmsw30u_xrc.a
libwxpng.a
libwxregexu.a
libwxscintilla.a
libwxtiff.a
libwxzlib.a

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4245
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Just can't get it to work..

Post by ONEEYEMAN » Wed May 27, 2020 5:30 pm

Hi,
PGU8 wrote:
Wed May 27, 2020 11:11 am
PB wrote:
Wed May 27, 2020 10:08 am
PGU8 wrote:
Wed May 27, 2020 9:48 am
now it gives me another error of -lwxmsw30u could not be found. I looked at the lib folder and the file doesn't even exist, it doesn't exist anywhere..
The name library indicates that the linker is expecting the Release version of the Monolithic build of the library (e.g., in C::B project wizard, you checked "wxWidgets is built as monolithic library").

When you built wxWidgets by yourself and did not specify you want Release and Monolithic, the default build is Debug and Multilib.
For example, this will produce Static Debug Multilib wxWidgets build

Code: Select all

mingw32-make -f makefile.gcc
and this will produce Static Release Monolithic build

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1
ile If you want to have Dynamic build (wxWidgets libraries are linked as DLLs), you need to add

Code: Select all

SHARED=1
to the build parameters

So, did you build Release Monolithic library or obtained it by any other means (the official binaries are Dynamic Release Multilib)?
I decided to restart everything, here is my compile command:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 UNICODE=1 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 UNICODE=1 BUILD=release
The best way to build the library is:

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=0 UNICODE=1 BUILD=debug
An explanation:
- On Windows it is usually preferred to build 3rd party stuff statically. While dynamic linking is supported, it is more overhead when you try to create an installer and release you software, as now you need to remember to supply the additional set of libraries (wxWidgets)
- Building library as monolithic does not give you any gain and in fact sometimes can give you problems (when linking). Therefore unless you know what you are doing and know what exactly will happen, it is recommended to use multi-lib build.
- Setting the UNICODE is already a default option, but if you want a compatibility with the previous version of the library you can still supply it in the build command. It doesn't hurt.
- And of course building the debug version, especially if you are just starting working with wxWidgets.

And then when you go and create a project in C::B you will need to check/uncheck an appropriate settings.

Thank you.

Post Reply