Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: robl on January 29, 2011, 01:02:54 pm
-
Hi
I'm new to codeblocks, and trying to build a standalone .exe - It's a wxwidgets project.
I followed the instruction here (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef)) to set up the wxwidgets projects - (I used the wxPack installation option which includes the static libraries and made sure I left the "Use __WXDEBUG__ and Debug wxWidgets lib" UNchecked when creating the project)
It all builds fine in codeblocks - i.e. build + run works fine but the executable in the bin/release folder doesn't run - it come up with an error: "The program can't start because wxmsw28u_gcc.dll is missing from your computer"
1) why is it needing a dll? I thought I was building a "realease" not a "dll release" - i.e. all dll should be compiled into the exe. I can't see any obvious options for making sure it's a full release. Where abouts are they? (in VC++ express it's under the compilation options and change it from "multithreaded dll" to "multithreaded" - I can't see the equivalent in codeblocks)
2) the file does actually exist here: "c:\wxWidgets2.8\lib\gcc_dll\wxmsw28u_gcc.dll", I've set up the global "$(#wx)" variable to point to "c:\wxWidgets2.8" and directories "c:\Program Files\CodeBlocks\MinGW\bin\" and "c:\wxWidgets2.8" are in my "path" environment variables
Can anyone help me out please - I'm guessing it's very obvious but it's defeating me at the moment!
Cheers
Rob
p.s. Have just added c:\wxWidgets2.8\lib\gcc_dll\ to the path env. variable so now runs on this pc but will not run on other pc's not containing these libraries - how can I link the referenced libraries into the executable? - i.e. a NON-dll release
-
I had this exact problem recently. I got around it by starting a second project with the same source files but untick the "Use wxWidgets dlls", use the monolithic library. If you look at the size of of your .exe it'll be tiny (55kb in my case), but the .exe with the monolithic library build will be much bigger (2.5mb ) and runs independantly of C::B.
Incidently, I found Dependancy Walker very useful in probing this bug/feature.
I hope you fiind this useful.
Mark Scott Cousins
-
Hi,
you have certainly built a wxwidget dll, so a dynamic library. If you link your project with this library, the linker resolves the links it needs with that library. So this library is also needed at run time.
If you want a completely independent executable, you need to link with a wxwidgets static library. You can generate one by using SHARED=0 on your make -f makefile.gcc ... line when you build wxwidgets. Your new static libraries will be in something like c:\wxWidgets2.8\lib\gcc_lib.
gd_on
-
Cheers for that Mark, unfortunately I now get:
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x562): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2016): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2162): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x29cf): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2a5f): undefined reference to `_Unwind_Resume'
and a lot more of them! Any ideas? - Maybe I need to build wxwidgets manually rather than from wxPack?
-
Cheers for that Mark, unfortunately I now get:
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x562): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2016): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2162): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x29cf): undefined reference to `_Unwind_Resume'
C:\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_string.o):string.cpp:(.text+0x2a5f): undefined reference to `_Unwind_Resume'
and a lot more of them! Any ideas? - Maybe I need to build wxwidgets manually rather than from wxPack?
wxWidgets must be built and used with Compilers Compatible with each other!
IIRC, The above message means you are mixing SJLJ and DW2 versions of MinGW GCC compilers.
Tim S.
-
Thanks Tim, I didn't actually build wxWidgets myself - I used wxPack which comes with pre-compiled libraries. I actually followed the advice that is on the CodeBlocks wiki - (link on my first post). Do you think it's worth mentioning on the wiki that the version of the compiler that ships with Code::Blocks doesn't work with the libraries in wxPack? Or have I got the wrong end of the stick? I couldn't see an option to change the version in CodeBlocks - Have to admit this is all new to me i.e. I just thought the MinGW GCC compiler would work. Every day is a school day!
Rob
oh...just had a touch of the RTFM's - bottom line of wiki FAQs =
"I get errors like "undefined reference to _Unwind_*"
wxWidgets was built with a different version of GCC than the one you're currently using. You need to rebuild wxWidgets with the same version of GCC that you use to compile your program.
I guess codeblocks is more up to date with its version of minGW GCC compiler than the one used to build in wxPack
-
.....and so the pain continues...
All is good on my coding machine - I compiled wxWidgets with the static, monolithic options. And the executable runs on this machine. However trying to run it on other pc's (i.e. with no code::blocks, gcc, wx etc) it bombs out with "application failed to start because mingwm10.dll doesn't exist - i.e. the mingw gcc dll has failed to be linked into the .exe. It must be possible to produce an .exe for distribution???? But how? Sorry for my ignorance! and cheers for any help
Rob
-
Learn how to use the newest TDM MinGW GCC; I believe there is a option to do a static link of the C Run-time.
Note, I am not sure of the above. Read it in a post on this site or maybe TDM site, cboard, or another site.
You really need to post questions about the compilers on a better site than this site; which is to support Code::Blocks not Compilers.
Tim S.
-
Also learn how to use google or any other search engine ----> http://lmgtfy.com/?q=static+link+mingwm10.dll :P
-
Fair enough!
-
Hi there
I'm trying to compile a standalone exe ...
I've installed:
- CB 10.05 + Mingw
- wxPack_v2.8.9.02
and I tried to start a prj from template, using wxSmith, but the best I can obtain requires at least mingwm10.dll ...
could someone help me, may be sending a sample cb porject?
thanx :)
-
I found a way for windows ... I post it here ...
1] download and install CB & MingW [codeblocks-10.05mingw-setup.exe]
NB to easily compile WxWidgets I installed CB in "C:\CodeBlocks" instead of c:\Program Files
2] download and install wxMSW [wxMSW-2.8.12-Setup.exe] from http://www.wxwidgets.org/downloads/
NB to easily compile WxWidgets I installed wxMSW in C:\wxWidgets-2.8.12
3] move to "C:\wxWidgets-2.8.12\build\msw" and create a batch file as following (monolithic lib no dll for release)
path C:\CodeBlocks\MinGW\bin
C:\CodeBlocks\MinGW\bin\mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 RUNTIME_LIBS=static SHARED=0
4] launch the batch file and wait until the libs are built [C:\wxWidgets-2.8.12\lib\gcc_lib]
(if you need also debug build just rebuild with "BUILD=debug" option)
5] then launch CB and 'create a new project' wizard with wxWidgets
- select wxWidgets 2.8.x
- select title and dir for the project
- select gui wxSmith and Frame based
- select wxWidgets' location "C:\wxWidgets-2.8.12"
- select Release configuration (or Debug if you have built with Debug option)
- select only "wxWidgets is built as monolithic library"
6] in Project
Build option
Compiler Settings
Other Options
delete "-mthreads" option
7] in Project
Build option
Linker Settings
Other linker Options
delete "-mthreads" option
add "-static-libgcc" option
that's it!!! :)
Hoping this could help... :)
PS thanx to http://dev.arqendra.net/#cbnb where I got some good advice...
-
very nice tutorials. hope it can put in wiki. but I guess the wiki has already some similar materials. :D
-
I used
- C:\wxWidgets-2.9.4\build\msw
- echo %PATH% (to see if i still have C:\Program Files (x86)\CodeBlocks\MinGW\bin), and I do.
- mingw32-make.exe -f makefile.gcc clean
- mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 RUNTIME_LIBS=static SHARED=0
I opened Code::Blocks and I tryed to make a new project.
However, it didn't allow me to make a new project only with monolithic. It obligated me to use "Use WX dll" and "use unicode" too. This is my old build. I want to change it to what you instructed because I need a stand-alone exe, and the old build has SHARED=1 and doesn't have static runtime_libs.
What am I doing wrong?
-
Should I just reinstall Windows ?
-
- mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 RUNTIME_LIBS=static SHARED=0
Is this possible at all with MONOLITIC? When I built wx in a static way I used:
mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=1
...and that works pretty well.
Don't know what "RUNTIME_LIBS=static" does for a static build anyways...?! Where did you get that instructions from?
Should I just reinstall Windows ?
LOL - sure, 10 times, please. ;D