Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Mel_3 on March 12, 2012, 04:52:32 am

Title: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 12, 2012, 04:52:32 am
Downloaded & installed CB10.05 minGW package on XP Pro PC - Builds & Runs Console App "Hello World" fine.

Files installed to c:\program files\codeblocks
and c:\program files\codeblocks\MinGW
I see wxSmithlib.dll and other dll's in c:\program files\codeblocks\
I see wxSmith on the Menu now but when I attempt to create a new project ...  C::B ask me for wxWidget's location.

Click New | project | wxWidgets |Next | wxWidgets 2.8 | Enter Proj Title | Click Next | Next | Select wxSmith & Frame Based | Click Next

then... C::B ask me for wxWidget's location.

I then clicked the Button with the 3-dots and C::B opens a Global Variable Editor window. I'm unsure how to use this.

Is this an "Environment Variable" issue or what?

If it is an Environment Variable issue... I looked at manually setting via...
- Right Click My Computer | Properties | Advanced | Environment Variables
- Then what?

I see...
- User Variables and
- System Variables
Which should I create?
What goes in "Variable" field?
What goes in "Value" field?

BTW, I was attempting to follow the Tutorial at...
http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Hello_world

Thanks for any help.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 12, 2012, 05:47:22 am
Did you read and understand the info on this link?
http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef)

Do you have wxWidgets built to work with your Compiler?

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 12, 2012, 01:40:23 pm
Stahta01,

First: Thank you for your help. I really want to get this going...

Second: I did read the link http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

And tried to follow the instructions but since I have not played with Environment Variables before once I did this...
- Right Click My Computer | Properties | Advanced | Environment Variables
to open the Environment Variables Window I was unsure which I should choose...
a - User Variables
b - System Variables
AND...
was unsure what went in the two fields...
a - Variable Field
b - Value Field

I tried creating a new System Variable with Variable = Path and Value = c:\program files\code blocks
But the command line test shown on the link

C:\>mingw32-gcc
mingw32-gcc: no input files
C:\>

Did not respond as they said it should

Third:
I had the impression wxSmith & wxWidgets were came with Code::Blocks since I saw wxSmith as a Menu Item and saw wxWidgets as a Project Type...
I think now that Code::Blocks just comes with the "hooks" and I must download wxWidgets.
But the more I read the more confused I get on the 3-items wxSmith, wxWidgets, and wxFormBuilder.
- I thought I read they were 3 different "tools" -
- then I thought I read wxFormBuilder was a "tool" in wxWidgets...

So what do I download to get the ability to create Forms with controls like Buttons, Combo/Drop-Down Boxes, etc... and associate/attach code to various events for the controls?

Again, I really thank you for the help.

Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 12, 2012, 01:46:45 pm
Code::Blocks DOES NOT include the wxWidgets library source code (wxWidgets headers etc.).

Do you have any prior programming knowledge?

What is the name and version of your Compiler?

OS Name, 32/64 bits, and version?

Tim S.

Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: MortenMacFly on March 12, 2012, 01:56:11 pm
1.) Code::Blocks is an IDE that drives your compiler
2.) wxFormBuilder is a stand-alone tool that allows creating source code for UI's based on wxWidgets
3.) wxSmith is an integrated C::B plugin that allows the same
4.) You'll need a compiled development version of wxWidgets if you want to develop wxWidgets apps. No matter what IDE/tool you choose. Its the same for every other library you intend to use.
5.) You need to compile wxWidgets in the flavour you need for your apps. This library can be compiled in many flavours.
6.) You might checkout wxPack instead which is a compilation of pre-compiled wxWidgets versions for development.
7.) Don't fiddle with Windows system variables, especially if you don't know what they do. You can setup envvars inside Code::Blocks using the EnvVars plugin or (in the case of wxWidgets) C::B is looking for a global compiler variable, named "wx". Consult the C::B documentation accordingly (see my sig).
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 12, 2012, 10:17:01 pm
stahta01 - Thanks for the clear statement regarding wxWidgets not being included with C::B

Here are the answers to your 3 questions:

Question 1:
- Prior Programming Experience = ASM/embedded processors, ASM/Desktops, Basic, Visual Basic, VBA, PHP, ASP, HTML, CSS, XML, and a little Java Script. I understand OOP, Creating Cless's, Objects/Instances of the Class, and using Methods and setting Properties, etc
- BUT in recent years I've only done occasional programming
- I'm just starting to play with C and C++ and...
.. have installed Microsoft Visual Studio Express - and have done a few simple console app's.
.. have installed Code::Blocks minGW - and built and run a few simple console apps in both C and C++ (C::B 10.05)
- I have used GUI's to create code but often work only with a text editor customizing or doing scratch code

Question 2:
- The compiler I'm using is the minGW ver that came with the C::B package download for PC's
- It looks like I installed it August of 2011 but have just now started to play with it in an attempt to get up to speed.
- C::B ver = 10.05 Rev 6283 Build May 27, 2010 19:10:05(windows unicode)- 32 bit
- minGW ver = ? in c:\program files\codeblocks I see mingwm10.dll
- I've looked for command line way to run minGW/gcc to get ver # but have yet to find out how.

Question 3:
I've loaded C::B onto an XP Pro 32bit PC with all the latest updates.

MortenMacFly - Thank you for the concise list - that helps.

Responses to your items...
1 - Got it on what C::B is/does.

2, 3, 4, 5 -  So wxSmith needs compiled wxWidgets to work... wxSmith is included with C::B but I have to download & compile wxWidgets - right?

6 - As a newbie to C++, C::B, etc this would save me having to figure out how to download & compile wxWidgets... right?
I'll download it as you suggest but would like to learn to use C::B & minGW to compile wxWidgets... unless it takes a different gcc compiler version...

7 - I'll consult the C::B doc's as you suggest... but am interested in learning how to set the Windows Environment Variables as well.

Thanks again for the help Guys.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 13, 2012, 01:56:01 am
Here is the batch file command I used to compile the wxWidgets using the MinGW sub folder under Code::Blocks 10.05.

Code
REM Add MinGW Bin folder to the system path
SET PATH=C:\Program Files\CodeBlocks\MinGW\bin;%PATH%

REM Change to the wxWidgets build directory
cd /D H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.8.10-SJLJ\build\msw

REM Clean the release monolithic unicode DLL build
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1 clean
REM Create the release monolithic unicode DLL build
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1

PAUSE

NOTE: The pause command is only needed if you run the command in a batch file and wish to see the build output.
NOTE: You need to adjust the "cd" command to where ever you download the wxWidgets source code.

I do NOT think it is safe to help you set the system environmental variable to add the MinGW Bin folder to it. If you do it wrong you can make PC non boot-able. That is why I adjust the PATH variable via the SET command instead.

NOTE: It takes my old PC about 3 hours to Compile a single build of wxWidgets; about the last hour of that is doing the link command.


Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 13, 2012, 02:09:31 am
Tim,

Great ! Thanks for the batch file. I'll give it a try tomorrow and report back.

Your right on the Environment Variables... I wiped out the PATH's Sunday and had to so a system Restore to the Saturday status...

I now see I should have clicked Edit and appended to the existing paths and not have clicked New... which cleared the Path variable(s)

And as I read (here?) it may be better to do this on a session basis and not permanently modify the Path Environment Variable.

Thanks again for the kind assistance !!!


Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 13, 2012, 02:22:58 am
FYI:

My build just error out and Google implies my MinGW ld command is the likely cause.
I think my CB MinGW is the original shipped with CB 10.05.

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 13, 2012, 03:04:27 am
Tim,
fyi... on my system...
> mingw32-make --version
reports GNU Make 3.81
So that is what came when I downloaded C::B minGW package

You said: "My build just error out and Google implies my MinGW ld command is the likely cause."

How would you change your batch file to correct this so that the compile was successful?

thanks again for the help !!!
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 13, 2012, 02:36:18 pm
Change "MONOLITHIC=1" to "MONOLITHIC=0".
Or changed the MinGW Binutil's LD to a newer version.

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 13, 2012, 11:07:25 pm
Da Da !!! I got wxWidgets to compile. Thanks Tim!

But when I attempted to create a wxSmith/wxWidgets project I got all the way to the end of the Project Setup then a Warning...

"A matching Debug Configuration cannot be found in the wxWidgets directory you specified.
This means that Debug target of your project will not be build.
Are you sure you want to continue with these settings?"

I was following the Tutorial at http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Hello_world

But some of the Dialog Box's of that Tutorial do not exactly match what came up during the Project Creation...

Below are the various Dialog Boxs CodeBlocks presented to me and my response...

Thanks for any help in getting through this gate !!!

- Click File | New | Project | wxWidget Project |
- Version wxWidgets 2.8x
- Preferred GUI Builder: wxSmith
- Application Type: Frame Based

Then the following...

===== Dialog Box 1 : --- wxWidgets project ---

Please select the location of wxWidgets on your computer.

wxWidget's location: c:\wxWidgets-2.8.12

===== Dialog Box 2 : --- Global Variable Editor

Current Set:       Default
Current Variable:   wx
Bulletin fields
Base:         c:\wxWidgets-2.8.12
(Other fields on this Dialog left blank)

===== Dialog Box 3 : --- wxWidgets project ---

Please select the compiler to use and which configurations yu want enabled in your project.

Compiler: GNU GCC Compiler

_x_ Create "Debug" configuration:    [ Debug ]

  "Debug" options
  Output dir.:             [ bin/Debug/ ]
  Objects output dir.:              [ obj/Debug/ ]

_x_ Create "Release" configuration:    [ Release ]
  "Release" options
  Output dir.:            [ bin/Release/ ]
  Objects output dir.:         [ obj/Release/ ]

===== Dialog Box 4 : --- wxWidgets project ---

Please select various configuration options.

What you select here, must match the installed wxWidgets library's settings

wxWidgets Librry Settings:
___ Use wxWidgets DLL
_x_ wxWidgets is built as a monolithic library
___ Enable unicode

Miscellaneous Settings:
___ Create Empty Project
_x_ Create and use precompiled header (PCH)
configuration: _____________________
___ Configure Advanced Options

===== Dialog Box 5 --- Warning ---

A matching Debug Configuration cannot be found in the wxWidgets directory you specified.
This means that Debug target of your project will not be build.

Are you sure you want to continue with these settings?

======================

Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 14, 2012, 12:34:01 am
What command did you use to compile wxWidgets?

Try checking "Configure Advanced Options" to see what the settings are for advanced Options.

The options used to build wxWidgets MUST be compatible with the CB wizard choices.

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Jenna on March 14, 2012, 12:57:45 am
And:
do you have a debug version of wxWidgets created, or just a release-version ?
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 14, 2012, 01:11:01 am
I guess not. I'm a total newbie to C++, CodeBlocks, wxSmith, and wxWidgets.

My goal is to use the wxSmith feature that came with Code::Blocks and to do this helpful folks here educated me that I needed to compile wxWidgets... And Tim S. was kind enough to guide me through that. Look at his batch file & modification he posted earlier in this thread to see how I did the compile)

I downloaded wxMSW from the wxWidgets website and did the default install.

Do I need to do a second compile of the debug version of wxWidgets?

Thanks for the help.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 14, 2012, 02:36:50 am
Did you use "MONOLITHIC=1" or did you use "MONOLITHIC=0"?

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 14, 2012, 01:56:55 pm
Tim,
- I used the Batch File you provided earlier in this thread... modified as you suggested...
- Change "MONOLITHIC=1" to "MONOLITHIC=0".
- The batch file I used is shown at the end of this post.
- It seems to have worked fine in that I got no errors.

I have been unable to find "Configure Advanced Options in CB. I looked under Settings | Compiler and Debugger
but did not see it there... and I'm not sure what I would change if I found it as I'm just not familiar  enough yet with the tools.

So I'm not sure what to do next.

I really want to get this setup done and working properly so I thank you and the others for your help!

(The batch file I used to compile wxWidgets is below.)

SET PATH=C:\Program Files\CodeBlocks\MinGW\bin;%PATH%
REM Change to the wxWidgets build directory
cd c:\wxWidgets-2.8.12\build\msw
REM Clean the release monolithic unicode DLL build
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=0 UNICODE=1 clean
REM Create the release monolithic unicode DLL build
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=0 UNICODE=1
PAUSE
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 15, 2012, 12:01:40 am
You NEED to Use the Multi-lib option in the Wizard NOT Monolithic when using a Multi-lib build of wxWidgets!

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 15, 2012, 12:27:15 am
I don't see a Multi-lib option.

Clicking through the New Project Wizard...

New Project | wxWidgets | wxWidgets 2.8x | myProject | Next | wxSmith | Frame Based | Next |
| c:\wxWidgets-2.8.12 | GNU GCC Compiler | Create Debug Config | Create Release Config |

Till I get to this screen... the choices are...

----------------------------------------------
wxWidgets Library Settings:
___ use wxWidgetsDLL
___ wxWidgests is built as a monolithic library
___ Enable Unicode

Misc Settings:
___ Create Empty Project
___ Create and use Pre-compiled Header
Configuration _____________________
___ Configure Advanced Options
----------------------------------------------

And no matter what I check box I check I get the WARNING...

"A matching debug configuration can not be found in the wxWidgets directory you specified.
This means the debug target of your project will not be built.
Are you sure you want to continue with these settings"

Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: stahta01 on March 15, 2012, 12:52:26 am
I have to give up helping you; I feel like I am playing twenty questions.

Tim S.
Title: Re: CB10.05minGW on XpPc: New wxWidgets wxSmith Proj - CB ask: wxWidgets Location ?
Post by: Mel_3 on March 15, 2012, 04:54:08 am
No problem Tim. Actually you were a big help.

Once I figure out how to get wxSmith & wxWidgets working I, hopefully, can get down to actually trying to write some code.

I'll keep working on this and digging around. It has to be something simple.

Thanks again for the great help you provided!