codeblocks, wxwidget as static library runtime error 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

codeblocks, wxwidget as static library runtime error

Post by PGU8 » Wed May 27, 2020 1:25 pm

by following this doc, WxWidgets_Build_Configurations, following the "Combinations of the common compile flags" part of

Code: Select all

SHARED=0 BUILD=release |  Builds static release libraries. 
my compile command using mingw,

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release
when I compile a simple gui, nothing happens, but I get the following error when trying to run the program:

Code: Select all

The code execution cannot proceed because wxmsw30u_gcc_custom.dll was not found. Reinstalling the program may fix this problem.
Clearly here the executeable is looking for a dll, but i built it as a static library why is it looking for a dll? I have looked around and most of the time people just tell each other to use the dynamic link. I'd like the program to be standalone without dll. Thanks.

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

Re: codeblocks, wxwidget as static library runtime error

Post by PB » Wed May 27, 2020 2:28 pm

PGU8 wrote:
Wed May 27, 2020 1:25 pm
Clearly here the executeable is looking for a dll, but i built it as a static library why is it looking for a dll?
Did you build the executable using static wxWidgets libraries as well? If you did it would not want wxWidgets DLLs (but still probably the GCC compiler ones).

In the other thread, you stated that you checked "Use wxWidgets as DLL" in Code::Blocks...

Please post the command line used to build your executable.

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

Re: codeblocks, wxwidget as static library runtime error

Post by PGU8 » Wed May 27, 2020 3:05 pm

PB wrote:
Wed May 27, 2020 2:28 pm
PGU8 wrote:
Wed May 27, 2020 1:25 pm
Clearly here the executeable is looking for a dll, but i built it as a static library why is it looking for a dll?
Did you build the executable using static wxWidgets libraries as well?
can you elaborate on this question? because I already recompiled everything according to the information above, a static wxwidget library like the docs says..

version: wxwidget 3.0
wxwidget location = C:\CodeBlocks\staticwxWidgets-3.0.5

create "debug" configuration = false
create "release" configuration = true

use wxwidget dll = false
wxwidget is built as monolithic library = false
enable unicode = true

create empty project = false
create & use precompiled header = false
configure advanced options = false

the next window is telling me that code blocks will not check for the existence of any libraries added below, such as wxAui, wxXrc, wxDbGrid, wxOdbc, wxMedia, etc...

build options, linker, etc is the default

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

Re: codeblocks, wxwidget as static library runtime error

Post by PB » Wed May 27, 2020 3:17 pm

So, you only built wxWidgets as static multilib and the libraries are in WXWIN/lib/gcc_lib, where the folder content looks as in the last list here. And obviously, you did not copy, move, or rename any files or folders.

My guess is you must have something wrong in your project. Either post the build output as I asked you before. It is not difficult to copy it from C::B, is it? It should look like (it's for wxWidgets 3.1, so the libraries have "31" and not "30" in their names):
------------- Build: Release in CB-LibTest (compiler: mingw-w64-i686-8.1.0-win32-sjlj-rt_v6-rev0)---------------

g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -c D:\Dev\Desktop\CB-LibTest\CB_LibTestApp.cpp -o obj\Release\CB_LibTestApp.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -c D:\Dev\Desktop\CB-LibTest\CB_LibTestMain.cpp -o obj\Release\CB_LibTestMain.o
windres.exe -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -J rc -O coff -i D:\Dev\Desktop\CB-LIB~1\resource.rc -o obj\Release\resource.res
g++.exe -LD:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib -o bin\Release\CB-LibTest.exe obj\Release\CB_LibTestApp.o obj\Release\CB_LibTestMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_html -lwxmsw31u_core -lwxbase31u -lwxpng -lwxjpeg -lwxzlib -lwxtiff -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -loleacc -luxtheme -mwindows
Output file is bin\Release\CB-LibTest.exe with size 7.81 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
Please notice that all paths above have gcc_lib and not gcc_dll in them.

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

Re: codeblocks, wxwidget as static library runtime error

Post by PGU8 » Wed May 27, 2020 3:30 pm

PB wrote:
Wed May 27, 2020 3:17 pm
So, you only built wxWidgets as static multilib and the libraries are in WXWIN/lib/gcc_lib, where the folder content looks as in the last list here. And obviously, you did not copy, move, or rename any files or folders.

My guess is you must have something wrong in your project. Either post the build output as I asked you before. It is not difficult to copy it from C::B, is it? It should look like (it's for wxWidgets 3.1, so the libraries have "31" and not "30" in their names):
------------- Build: Release in CB-LibTest (compiler: mingw-w64-i686-8.1.0-win32-sjlj-rt_v6-rev0)---------------

g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -c D:\Dev\Desktop\CB-LibTest\CB_LibTestApp.cpp -o obj\Release\CB_LibTestApp.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -c D:\Dev\Desktop\CB-LibTest\CB_LibTestMain.cpp -o obj\Release\CB_LibTestMain.o
windres.exe -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib\mswu -J rc -O coff -i D:\Dev\Desktop\CB-LIB~1\resource.rc -o obj\Release\resource.res
g++.exe -LD:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_lib -o bin\Release\CB-LibTest.exe obj\Release\CB_LibTestApp.o obj\Release\CB_LibTestMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_html -lwxmsw31u_core -lwxbase31u -lwxpng -lwxjpeg -lwxzlib -lwxtiff -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -loleacc -luxtheme -mwindows
Output file is bin\Release\CB-LibTest.exe with size 7.81 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
Please notice that all paths above have gcc_lib and not gcc_dll in them.
The libraries are in lib/gcc_lib, yes the folder content is exactly the same as the link you provided. no file was moved, renamed or deleted. here is the log file

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

Re: codeblocks, wxwidget as static library runtime error

Post by PB » Wed May 27, 2020 3:42 pm

PGU8 wrote:
Wed May 27, 2020 3:30 pm
The libraries are in lib/gcc_lib, yes the folder content is exactly the same as the link you provided. no file was moved, renamed or deleted. here is the
-------------- Build: Release in static (compiler: GNU GCC Compiler)---------------

windres.exe -IC:\CodeBlocks\staticwxWidgets-3.0.5\include -IC:\CodeBlocks\staticwxWidgets-3.0.5\lib\gcc_lib\mswu -IC:\CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\mswu -J rc -O coff -i D:\codeblocks\static\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\CodeBlocks\staticwxWidgets-3.0.5\include -IC:\CodeBlocks\staticwxWidgets-3.0.5\lib\gcc_lib\mswu -IC:\CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\mswu -c D:\codeblocks\static\staticApp.cpp -o obj\Release\staticApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\CodeBlocks\staticwxWidgets-3.0.5\include -IC:\CodeBlocks\staticwxWidgets-3.0.5\lib\gcc_lib\mswu -IC:\CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\mswu -c D:\codeblocks\static\staticMain.cpp -o obj\Release\staticMain.o
mingw32-g++.exe -LC:\CodeBlocks\staticwxWidgets-3.0.5\lib\gcc_lib -LC:\CodeBlocks\wxWidgets-3.0.5\include -o bin\Release\static.exe obj\Release\staticApp.o obj\Release\staticMain.o obj\Release\resource.res -s -mthreads -lwxmsw30u_core -lwxbase30u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 C:\CodeBlocks\wxWidgets-3.0.5\lib\gcc_dll\libwxmsw30u.a -mwindows
From those all "gcc_dll" in the log mixed with "gcc_lib" it is pretty obvious that your C::B project is badly broken. You need to fix it, removing/replacing all the references to dynamic build with static ones.

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

Re: codeblocks, wxwidget as static library runtime error

Post by PGU8 » Wed May 27, 2020 3:57 pm

PB wrote:
Wed May 27, 2020 3:42 pm
From those all "gcc_dll" in the log mixed with "gcc_lib" it is pretty obvious that your C::B project is badly broken. You need to fix it, removing/replacing all the references to dynamic build with static ones.
Alright so that's the problem, I'm completely new to working with IDE, can you explain what you mean with replacing reference & what to do?

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

Re: codeblocks, wxwidget as static library runtime error

Post by PB » Wed May 27, 2020 7:15 pm

At this point, I would just create a new project. If you tell Code::Blocks to not use the shared build, it should set everything properly.

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

Re: codeblocks, wxwidget as static library runtime error

Post by PGU8 » Thu May 28, 2020 6:01 am

It was the messed up code block's global compiler setting from using wxwidget's dynamic library default configuration, the global compiler setting is still set up to the dynamic library and thus resulting in a messed up compile. the second problem was the messed up default configuration for wxwidget's static library where it doesn't include some libraries. I wish this doesn't happen to the latest version 3.1

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

Re: codeblocks, wxwidget as static library runtime error

Post by PB » Thu May 28, 2020 7:11 am

That is not on wxWidgets but on the user using Code::Blocks.

FWIW, I have always believed that adding a library-specific settings to the global compiler settings is a bad idea. Those belong to the project settings.

Post Reply