Author Topic: WxWindows, makefile... help a newbie! :)  (Read 6005 times)

barabba

  • Guest
WxWindows, makefile... help a newbie! :)
« on: July 01, 2006, 08:41:47 pm »
Hello!  I must complete a school project on c++, so I decided to find out a good IDE.  I like Code::Blocks very much, it seems fast and customizable.  But I have some problems: my project has to be done using cygwin (i.e. : it should compile under cygwin shell without errors) and WxWindows 2.4.2.

This morning (european time :\ ) I installed the 30/06 night build of Code::Blocks, and it runs quite well... but I have not been able to solve these two problems:

First: I must use a makefile from cygwin make.exe, not from mingw32-make.exe, that my CB uses by default. So, where can I choose which binary to use when using a custom makefile?

Second: I got a compiled and working WxWindows 2.4.2 dll.  Unfortunately, the project wizard only supports WxWidgets, the newer version.  So, the question is: what settings should i use to make CB recognize WxWindows libraries, allowing them to be used in my code (without the risk of ambiguity with the newer 2.6.x)??

A huge thank you to anyone will bother answering :)

Francesco

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: WxWindows, makefile... help a newbie! :)
« Reply #1 on: July 01, 2006, 10:22:13 pm »
For the Cygwin compiler, have a look in the WiKi here:
http://wiki.codeblocks.org/index.php?title=Installing_Cygwin_Compiler

For the wxWidgets I'd suggest you install a "DevPak" of this version. The DevPak download plugin only shows wxWidgets 2.6.1+, but it you google around you'l sureely find an "old" wxWdgets 2.4.2 (e.g. http://old.devpaks.org/show.php?devpak=106). Anyway: Unless you are using specific 2.6.x functions you could still implement your application with wxWidgets 2.6.x and compile it at work / studies with the old library. To make sure that you aren't using v2.6.x functionality I recommend you simply only look inside the 2.4.2 SDK documentation (http://www.wxwindows.org/manuals/2.4.2/wx_contents.html).

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

barabba

  • Guest
Re: WxWindows, makefile... help a newbie! :)
« Reply #2 on: July 01, 2006, 10:54:54 pm »
For the Cygwin compiler, have a look in the WiKi here:
http://wiki.codeblocks.org/index.php?title=Installing_Cygwin_Compiler

For the wxWidgets I'd suggest you install a "DevPak" of this version. The DevPak download plugin only shows wxWidgets 2.6.1+, but it you google around you'l sureely find an "old" wxWdgets 2.4.2 (e.g. http://old.devpaks.org/show.php?devpak=106). Anyway: Unless you are using specific 2.6.x functions you could still implement your application with wxWidgets 2.6.x and compile it at work / studies with the old library. To make sure that you aren't using v2.6.x functionality I recommend you simply only look inside the 2.4.2 SDK documentation (http://www.wxwindows.org/manuals/2.4.2/wx_contents.html).

With regards, Morten.

Thank you very much, but I fear I've not been able to explain my problem.

I've got WxWindows 2.4.2 installed, and I've got a working cygwin.  I've got a sample project, and it compiles flawlessy just typing "make" in the project directory in cygwin shell.

So the question could be reduced to: how can I make the same project compile under Code::Blocks?  How do I import the makefile and use the make.exe makefile, if needed?  And, more important: which flags should I use for linker and compiler, how should I set global variables, paths and such things in C::B to get it work with WxWin 2.4.2?

:(

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: WxWindows, makefile... help a newbie! :)
« Reply #3 on: July 01, 2006, 11:18:53 pm »
Again: I hope you've attached the Cygwin compiler as described in the WiKi article, becasue this is required!

Then create a wxWidgets project using the C::B wizard. This will ensure that you have setup your project for wxWidgets in general. Look through the build options and replace anything like "wxmsw26" with "wxmsw42" (you get the point). These are the wxWidgets library you need to link against.
You then can replace the "main.cpp" created by the wizards with your "main" file and add other files to the project if neccesary. This wizard will ask you for the path to the wxWidgtes libs - setup this to you wxWidgets installation and/or setup a global variabe named "wx" to point to this directory, too. I assume you've compiled wxWidgets under Cygwin then as I'm not aware of any wxWidgets package available pre-compiled for Cygwin...?!
You cannot import a makefile, but you can read the makefile to understand what it does. It basically sets the compiler/linker settings as required and compiles/links several files accordingly. You can have a look at special compiler/linker option in this file you may need to apply to your C::B project, too.
Finally make sure your project does not use the MinGW GCC but your newly added Cygwin compiler. You'll find all these settings in the project setup and/or the build options.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

barabba

  • Guest
Re: WxWindows, makefile... help a newbie! :)
« Reply #4 on: July 02, 2006, 03:35:25 pm »
thank you again!  more on the problem:

I installed WxWindows with Cygwin, it was among the packets that could be installed with the cygwin offline installation that school has given us.

The Wx's dlls are installed under /src/local in cygwin directory, but that is not the problem - i could change all the paths, obviously.  The problem is that the wx-config that came with this build is a unix one (no exe), which works perfectly if building from cygwin shell, but cannot be called from a windows shell like cmd.exe or directly from Code::Blocks.

I tried to install a wx-config (for windows) packet downloaded from the net: after compiling and setting the global WXWIN variable at the libraries location, it says that it cannot detect any library installed on that path.  But the unix wx-config had EXACTLY the same path in its configuration, and works flawlessy.

So I really don't know how to make my wxwindows work with code::blocks :\

any idea?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: WxWindows, makefile... help a newbie! :)
« Reply #5 on: July 02, 2006, 06:49:36 pm »
The problem is that the wx-config [...]
any idea?
...sure! ;-)
wx-config expects some command line params (was it --compile for compilation an --libs for linking - I don't remember!?). Provided with this it simply returns the command line that has to be provided to the compiler / linker. Thus the oputput of a call to the script will return e.g. "-DwxUSE_NICODE -dwxMyDef -DwxMyOtherDef", or "-lwxmsw26 -lmylib1 -lmyotherlib2" etc. You don't need to call this script at all from with your C::B project. What you have to do is to have a look, what the call to this script actually creates for a command line "AddOn". This you can analyse and add the options to your wxWidgets project accordingly. For example: if "wx-config --libs" shows a "-lwxmsw26" this in fact means, link the library "wxmsw26" to your project. Try calling wx-config from a cygwin shell and you'll see all other options.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

barabba

  • Guest
Re: WxWindows, makefile... help a newbie! :)
« Reply #6 on: July 02, 2006, 07:14:02 pm »
Got it working!  I feel a bit silly because I should have understood that by myself :?

Thank you for your aid :)