Author Topic: wxWidgets DLL problem  (Read 10724 times)

Offline Dastas

  • Single posting newcomer
  • *
  • Posts: 8
wxWidgets DLL problem
« on: May 13, 2008, 08:17:10 pm »
Hello,

I have compiled wxWidgets using the commands from http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.6.2_to_develop_Code::Blocks_%28MSW%29

I have created a GUI application which compiles and runs fine from the compiler, but when I attempt to run it from the release dir, I get the following error: "This application has failed to start because wxmsw28u_gcc_custom.dll was not found. Re-installing the application ...".

I have read in another thread that this might have something to do with the SHARED flag. I have also recompiled with SHARED = 0 (I just used clean and build commands. Did I have to uninstall something before?)

I'm running out of ideas. I don't want to have to distribute this DLL with the application.

Any suggestions appreciated, thanks.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets DLL problem
« Reply #1 on: May 14, 2008, 01:41:18 am »
I suggest looking at these directions

http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.6_to_develop_Code::Blocks_(MSW%29


Since your program wants the 2.8 DLL as it asks for wxmsw28u_gcc_custom.dll

Tim S
« Last Edit: May 14, 2008, 01:43:41 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: 7588
    • My Best Post
Re: wxWidgets DLL problem
« Reply #2 on: May 14, 2008, 01:53:23 am »
I'm running out of ideas. I don't want to have to distribute this DLL with the application.

FYI: I would distribute the DLL as a separate download. Helping people compile the DLL the DLL is work.

Or do you not wish to use the DLL and instead make a Static build? With a Static build the EXE will contain the wxWidgets code so it will be larger.

To do a Static build compile wxWidgets using SHARED=0; then change you program to use the static library.
The way to do this varies, sometimes you just change "gcc_dll" to "gcc_lib".

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 Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #3 on: May 14, 2008, 12:16:13 pm »
I'm running out of ideas. I don't want to have to distribute this DLL with the application.

FYI: I would distribute the DLL as a separate download. Helping people compile the DLL the DLL is work.

Or do you not wish to use the DLL and instead make a Static build? With a Static build the EXE will contain the wxWidgets code so it will be larger.

To do a Static build compile wxWidgets using SHARED=0; then change you program to use the static library.
The way to do this varies, sometimes you just change "gcc_dll" to "gcc_lib".

Tim S

I don't mind if the exe is bigger, I just don't want to have to distribute anything else except the exe.

That is correct, I don't want to use the DLL at all. Could you please explain how to make a Static built? As I said, I first compiled with SHARED = 1, read that it should be SHARED=0, so I ran the compile command with BUILD=release clean, then the command at http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.6_to_develop_Code::Blocks_(MSW%29 with SHARED=0. No errors occured, but I wonder, was this enough or should I have done something more to uninstall the previous compiled version?

Also, how would I change my program to use the static library? I have no idea what it uses right now, nor how I can check...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets DLL problem
« Reply #4 on: May 14, 2008, 07:35:43 pm »
Also, how would I change my program to use the static library? I have no idea what it uses right now, nor how I can check...

Note, the four steps below can be done in the IDE in the search directory settings area.

1. Backup your project cbp file.
2. Open the project cbp file in a text editor
3. Look for gcc_dll in the text editor.
    If found, change to gcc_lib
4. save changes

If the above does not work, I need to know how you created the project. Wizard? And, Wizard options?

Or you can post the cbp file if it is small enough.

Mainly just need these areas of cbp file Compiler and Linker

Code
		<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-pipe" />
<Add option="-mthreads" />
<Add option="-fmessage-length=0" />
<Add option="-fexceptions" />
<Add option="-Winvalid-pch" />
<Add option="-DHAVE_W32API_H" />
<Add option="-D__WXMSW__" />
<Add option="-DWXUSINGDLL" />
<Add option="-DcbDEBUG" />
<Add option="-DCB_PRECOMP" />
<Add option="-DWX_PRECOMP" />
<Add option="-DwxUSE_UNICODE" />
<Add directory="$(#WX.include)" />
<Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)\msw$(WX_SUFFIX)" />
<Add directory="include\wxscintilla\include" />
<Add directory="include\tinyxml" />
</Compiler>

Code
		<Linker>
<Add library="wxmsw28$(WX_SUFFIX)" />
<Add directory="base\tinyxml" />
<Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)" />
</Linker>


Tim S
« Last Edit: May 14, 2008, 07:38:02 pm 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 Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #5 on: May 14, 2008, 08:28:12 pm »
I did those four steps and then I couldn't even run the program from the compiler. It said it can't find a dll file. Also, I found four occurences in my cbp file of "gcc_dll", and I replaced them all. Do I only need to replace some?

I'm posting the fields you asked (before changing anything).

Code
				<Linker>
<Add option="-s" />
<Add library="C:\wxWidgets-2.8.7\lib\gcc_dll\libwxmsw28u.a" />
<Add directory="C:\wxWidgets-2.8.7\lib\gcc_dll" />
</Linker>

Code
		<Compiler>
<Add option="-Wall" />
<Add option="-pipe" />
<Add option="-mthreads" />
<Add option='[[if (PLATFORM == PLATFORM_MSW &amp;&amp; (GetCompilerFactory().GetCompilerVersionString(_T(&quot;gcc&quot;)) &gt;= _T(&quot;4.0.0&quot;))) print(_T(&quot;-Wno-attributes&quot;));]]' />
<Add option="-Winvalid-pch" />
<Add option="-include wx_pch.h" />
<Add option="-D__GNUWIN32__" />
<Add option="-D__WXMSW__" />
<Add option="-DWXUSINGDLL" />
<Add option="-DwxUSE_UNICODE" />
<Add option="-DWX_PRECOMP" />
<Add directory="C:\wxWidgets-2.8.7\include" />
<Add directory="C:\wxWidgets-2.8.7\contrib\include" />
</Compiler>

Thanks for your help!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets DLL problem
« Reply #6 on: May 14, 2008, 09:46:33 pm »
Does the path C:\wxWidgets-2.8.7\lib\gcc_lib exist?

And, does the file libwxmsw28u.a exist in that folder?

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 Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #7 on: May 15, 2008, 11:54:54 am »
Yes, the folder exists and that file is in there.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: wxWidgets DLL problem
« Reply #8 on: May 15, 2008, 02:56:51 pm »
Also, how would I change my program to use the static library? I have no idea what it uses right now, nor how I can check...

Also, how would I change my program to use the static library? I have no idea what it uses right now, nor how I can check...

Note, the four steps below can be done in the IDE in the search directory settings area.
...

The easier and quicker solution is to ask wxWidgets wizard to create a new empty project which uses statically build wx libraries. Then add your old project files to the empty project.
Be a part of the solution, not a part of the problem.

Offline Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #9 on: May 15, 2008, 05:16:31 pm »
How would I create such a project? I think I created the current project with Use wxWidgets DLL, built as monolithic library and Enable unicode all checked. Also use precompiled header is checked. Which one would need to be unchecked?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: wxWidgets DLL problem
« Reply #10 on: May 15, 2008, 05:46:04 pm »
How would I create such a project? I think I created the current project with Use wxWidgets DLL, built as monolithic library and Enable unicode all checked. Also use precompiled header is checked. Which one would need to be unchecked?

Uncheck the following option-
  • Use wxWidgets DLL

Check the following option-
  • Create Empty Project
Be a part of the solution, not a part of the problem.

Offline Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #11 on: May 16, 2008, 05:19:02 pm »
I tried creating a project that way and I get the error "Cannot parse newly created Wxs file. wxSmith support is disabled."

The thing is there's only a .cbp file in that folder. Is this normal, considering I checked Create Empty Project? Do I just copy my old project's files in there now?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: wxWidgets DLL problem
« Reply #12 on: May 16, 2008, 05:36:38 pm »
The thing is there's only a .cbp file in that folder. Is this normal, considering I checked Create Empty Project?

That's normal. Empty project will create the project files only.

Do I just copy my old project's files in there now?

Yes.
Be a part of the solution, not a part of the problem.

Offline Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #13 on: May 17, 2008, 06:19:07 pm »
I did that, I copied and added all my old files to the new project, and when trying to build and run I get the error:

This application has failed to start because wxmsw28u_gcc_custom.dll was not found. Re-installing ...

I even completely uninstalled wxsmith and reinstalled and recompiled (monolithic=1, shared=0, unicode=1), and this file is nowhere in my wxsmith folder... and now my old project doesn't compile because of the same error. If I edit the project file in a text editor, changing all gcc_dll to gcc_lib, the error about the dll goes away, but I do get a bunch of undefined reference compiler errors.

So, the empty project idea doesn't compile because of that dll error even after a full reinstall. I don't get it, why does this happen? There's no reference to gcc_dll anywhere in that project file and I compiled wxsmith with the command:

mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release

EDIT: I finally got it to compile right! And it also runs outside of the IDE just fine. There was a problem with the pch header, I think I forgot to check the option to use precompiled pch header, so I made another project with that enabled and it works just fine now.

One more thing: I added all my files to the project, but I still can't visually edit the form. It doesn't show up in resources.. any ideas how to get it to show (the .wxs file is only displayed as text)?
« Last Edit: May 17, 2008, 06:55:17 pm by Dastas »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: wxWidgets DLL problem
« Reply #14 on: May 18, 2008, 08:02:09 am »
One more thing: I added all my files to the project, but I still can't visually edit the form. It doesn't show up in resources.. any ideas how to get it to show (the .wxs file is only displayed as text)?

Because of this...

I even completely uninstalled wxsmith...
Be a part of the solution, not a part of the problem.

Offline Dastas

  • Single posting newcomer
  • *
  • Posts: 8
Re: wxWidgets DLL problem
« Reply #15 on: May 18, 2008, 09:21:24 am »
Well, I did install it back. Anyway I solved it by creating a non empty project and replacing the files. Everything works fine now.

Thanks for all your help!