Author Topic: Problem with wxWidgets  (Read 10753 times)

calande

  • Guest
Problem with wxWidgets
« on: March 04, 2006, 05:35:19 am »
Hello, I'm using Code::Blocks 1.0 and wxWidgets 2.6.2 on Windows XP.

But I'm having a few compilation errors:

Here's the 1st one:

L.5: wx/wx.h - No such file or directory

Any idea?
Thanks,

Charles.

PS: The full code is here.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2769
Re: Problem with wxWidgets
« Reply #1 on: March 04, 2006, 01:52:06 pm »
In the "build options" you need a compiler include
for \..\wxWidgets-262\include\wx\wx.h (wherever you put it.)

If you are using a nightly build, or an SVN version of CodeBlocks
you should just set this include via the menu item Setting/Global Variables/wx
You might also set the cb global variable item.



In future, could you please mention in your messages the full
CodeBlocks version you're using. I'm only guessing that you're
using nightly build because you mentioned wxWidgets 2.6.2.
You can find this info in the menu item Help/About/Information.


pecan
« Last Edit: March 04, 2006, 01:59:52 pm by Pecan »

calande

  • Guest
Re: Problem with wxWidgets
« Reply #2 on: March 04, 2006, 05:24:52 pm »
Thank you Pecan, I'm using 1.0 rc2.
Do you know why sometimes the option "build options" is greyed out?

Anyway, under "Build options > Custom variables", I added:

WX_DIR=C:\wxWidgets-2.6.2

I think this solved my original problem. Now, here's another error message:

C:\wxWidgets-2.6.2\include\wx\platform.h line 190 \wx\setup.h: No such file or directory

I checked out in the directory, and indeed the setup.h file is not there, instead there are: setup_inc.h and setup_redirect.h
Any idea?
Thanks,

Charles.

sethjackson

  • Guest
Re: Problem with wxWidgets
« Reply #3 on: March 04, 2006, 05:39:20 pm »
Thank you Pecan, I'm using 1.0 rc2.
Do you know why sometimes the option "build options" is greyed out?

Anyway, under "Build options > Custom variables", I added:

WX_DIR=C:\wxWidgets-2.6.2

I think this solved my original problem. Now, here's another error message:

C:\wxWidgets-2.6.2\include\wx\platform.h line 190 \wx\setup.h: No such file or directory

I checked out in the directory, and indeed the setup.h file is not there, instead there are: setup_inc.h and setup_redirect.h
Any idea?
Thanks,

Charles.

Need to put

$(WX_DIR)\lib\gcc_dll\msw or $(WX_DIR)\lib\gcc_lib\msw (it depends on wether you have a DLL build or not. gcc_dll for DLL build, gcc_lib for static build)

in compiler options. Oh and throw RC2 away. Get a nighlty from here.

http://forums.codeblocks.org/index.php?board=20.0

calande

  • Guest
Re: Problem with wxWidgets
« Reply #4 on: March 04, 2006, 06:57:55 pm »
Thank you. I wasn't able to install the nightly build, I get the following error message:

"This application has failed to start because wxmsw26u_gcc_cb.dll was not found. Re-installing the application may fix this."

Problem is there is no installer...  :?

BTW, I am using mingw, would this be a problem? Does GCC work on Windows BTW? (Sorry, I've only used GCC on FreeBSD...)
Thanks again,


Charles.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2769
Re: Problem with wxWidgets
« Reply #5 on: March 04, 2006, 07:41:03 pm »
"This application has failed to start because wxmsw26u_gcc_cb.dll was not found. Re-installing the application may fix this."

Problem is there is no installer...  :?

BTW, I am using mingw, would this be a problem? Does GCC work on Windows BTW? (Sorry, I've only used GCC on FreeBSD...)
Get quick announcements through the RSS feed http://www.codeblocks.org/nightly/CodeBlock_RSS.xml
A link to the unicode windows wxWidget dll for Code::Blocks : http://download.berlios.de/codeblocks/wxmsw26u_gcc_cb.7z
For those who might need this one (when no MingW installed on your system) : the mingw10m.dll : http://download.berlios.de/codeblocks/mingwm10.7z

For support of ansi builds, a link to the ansi windows wxWidget dll for Code::Blocks : http://download.berlios.de/codeblocks/wxmsw26_gcc_cb.7z

The 03 March 2006 build is out.
  - Windows : http://download.berlios.de/codeblocks/CB_20060303_rev2132_win32.7z
  - Linux : not supported yet

Notice that you can get the link libs from the same place you get the
nightly builds.

You can use the gcc and minGW that came with your codeblocks rc2.
With the nightly build you will be able to tell Codeblocks where to find
gcc.

pecan

Offline duncanka

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Problem with wxWidgets
« Reply #6 on: March 17, 2006, 05:54:52 am »
Thank you. I wasn't able to install the nightly build, I get the following error message:

"This application has failed to start because wxmsw26u_gcc_cb.dll was not found. Re-installing the application may fix this."
I received this same message when I tried to compile the latest SVN code and execute the devel version from within CB.  I have a wxmsw26u_gcc_custom.dll in the same folder as the executable, and I linked against a static library that was supposed to be using that DLL, yet I still keep getting this message.  Changing the DLL file's name to wxmsw26u_gcc_cb.dll only makes the problem worse - it tells me I don't have wxmsw26u_gcc_custom.dll, and even sooner in startup than the other way.  And if I have 2 copies, one with each name, it tells me some wxWidgets function isn't available in the DLL.  Any ideas?

takeshimiya

  • Guest
Re: Problem with wxWidgets
« Reply #7 on: March 17, 2006, 07:07:02 am »
Thank you. I wasn't able to install the nightly build, I get the following error message:

"This application has failed to start because wxmsw26u_gcc_cb.dll was not found. Re-installing the application may fix this."
I received this same message when I tried to compile the latest SVN code and execute the devel version from within CB.  I have a wxmsw26u_gcc_custom.dll in the same folder as the executable, and I linked against a static library that was supposed to be using that DLL, yet I still keep getting this message.  Changing the DLL file's name to wxmsw26u_gcc_cb.dll only makes the problem worse - it tells me I don't have wxmsw26u_gcc_custom.dll, and even sooner in startup than the other way.  And if I have 2 copies, one with each name, it tells me some wxWidgets function isn't available in the DLL.  Any ideas?

High likely you are experiencing DLL hell. Try to use the dll that was compiled for your version and never put it in a system dir.
And don't think that because they have the same name "wxmsw26u_gcc_cb.dll" they are compiled with the same settings (debug, unicode, etc), same compiler, same version, etc. :P
« Last Edit: March 17, 2006, 07:09:43 am by Takeshi Miya »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with wxWidgets
« Reply #8 on: March 17, 2006, 08:56:51 am »
High likely you are experiencing DLL hell.
This is not "DLL hell". The correct DLL (the one the app linked to) is just missing. Missing, that means not necessarily missing entirely, but missing in the sense that the OS can't find it.

You can technically use the DLL that you have been using (wxmsw26u_gcc_cb.dll) if you have compatible import libraries, but that is not good practice.
If you have any possibility, you should compile your own from scratch (or use a library from a DevPak).
EDIT: Also, if you have several versions of import libraries and DLLs, make sure you set up your linker paths correctly while building, so it really uses the one you think it does.

To run the program, you need a copy of the same library (same name and same build) somewhere the OS can find it. One safe way to accomplish this is to copy it to the program's directory. But be sure it is the right one. The custom version will not work in place of the cb version or vice versa (nor will two arbitrary custom versions from different people). Renaming another DLL is an extremely bad idea since it may cause the weirdest things, for example your app may start at first and crash for unknown reason later.

Another way to have a copy of the same library around is to copy it to a system folder (e.g. C:\windows\system32). This is not a good practice for distributing your software, and it requires prudence, as this can indeed lead to DLL hell.
What you absolutely have to keep in mind when doing this is that there must not be different versions with the same name in different locations. The loader will search the locations given by the PATH variable and pick the first DLL it finds, and this is not necessarily the one you want.

Nevertheless, although putting DLLs into the system folder is evil for the above reason, it can still be a valid option for you while developing, because it saves you from copying the same DLL over and over again for each and every program you write (which can be a pain).
« Last Edit: March 17, 2006, 08:59:23 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

sethjackson

  • Guest
Re: Problem with wxWidgets
« Reply #9 on: March 17, 2006, 12:59:18 pm »
I put the location (C:\wxWidgets-2.6.2\lib\gcc_dll) of the wx DLL in my path variable this avoids problems with DLL's.....

Offline duncanka

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Problem with wxWidgets
« Reply #10 on: March 17, 2006, 10:59:09 pm »
You can technically use the DLL that you have been using (wxmsw26u_gcc_cb.dll) if you have compatible import libraries, but that is not good practice.
If you have any possibility, you should compile your own from scratch (or use a library from a DevPak).
EDIT: Also, if you have several versions of import libraries and DLLs, make sure you set up your linker paths correctly while building, so it really uses the one you think it does.
Sorry, let me clarify: I did build the DLL myself from scratch, then linked against that static library the wxWidgets build created.  I then copied the DLL it built into my C::B devel directory.  Both the static library and the DLL used the "custom" extension.  The only reason I started using anything with the _cb extension was that my executable gave me an error saying that DLL wasn't present, so I tried copying the same DLL file I'd already copied, just under a different name.
So I'm pretty sure it's not a DLL hell issue, and my DLL is in a folder where the OS should be able to find it.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with wxWidgets
« Reply #11 on: March 18, 2006, 01:24:24 am »
Is it possible that you accidentially linked to both libraries?  This can happen for example if you specify one of them in the global compiler options, and the other in the project (or in the target).

It strikes me odd why it should complain about the missing _cb library if you really used the _custom one, otherwise.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."