Author Topic: Code::Blocks compile issue with wxWidgets  (Read 7078 times)

Offline dprowse

  • Single posting newcomer
  • *
  • Posts: 5
Code::Blocks compile issue with wxWidgets
« on: September 04, 2011, 06:39:35 pm »
Hi, first post.

I have had great success using Code::Blocks for use on console projects.
I had been using wxWidgets with wxDev but wanted to move on to a more current compiler/IDE/lib...so...now...

not so much success.

Installed Code::Blocks using codeblocks-10.05mingw-setup

I check for mingw32-make -v and get
GNUMAKE 3.81
built for i386-pc-mingw32
--> all good

Installed wxWidgets first from src and comping cmd line
(build options) mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1

had a great old time trying to get past the setup.h issue - compiler couldn't find it...searched directories on my computer found a copy and cut past. (read a few posts all the way back to 2005 and maybe something I missed here?)

seemed ok until I try a min project with wx where compliation seems to work until:

ld.exe||cannot find -lwxmsw28|

FINE..I reinstalled wx with wxPack_v2.8.8.04

same problem. So...what now...so close...

Here, I'll open a new project:
New Project
Select wxWidget project
nagged for version of wxWidg ... I select wxWidgets 2.8.x.x
I click Next >
path ... C:\Users\dp\Documents\c++\wx\anotherTest\testMyPatience\testMyPatience.cbp
I click Next >
Preferred GUI builder: None. // Application Type: Frame based.
I click Next >
wxWidgets location C:\wxWidgets-2.8.12
I click Next >
Under compiler selection GNU GCC Compiler
I see Create "Debug" and "Release" configuration both checked Output dir and Objects output dirs at: bin\Debug and Release respectively.
I click Next >

Under various configurations options:
->under wxWidgets Library Settings... I have variously check or not check the options.
*Use wxWidgets DLL
*wxWidgets is built as a monolithic library
*Enable unicode


->Miscellaneous Settings...
*Create Empty Project (not checked)
*Create and use precompiled header

(PCH) (not checked - though I find it interesting that the project still contains PCH)

I check  Configure Advanced Options ...
I click Next >

I get nag msgbx
"A matching Debug configuration cannot be found in the wxWidgets directory you specified. This means that the Debug target of you project will not build.
Are you sure you want to continue with these settings?"
I click 'Yes'

I get the same box with 'Release configurations' not found.
I click 'Yes'

Under advanced options window:
I leave Use__WXDEBUG__ and Debug wxWidgets lib unchecked
Debug target -> GUI Mode Application
Release Target -> GUI Mode Application

Finish

In new project I have:
testMyPatienceApp and Main .cpp
testMyPatienceApp and Main  .h
and resource.rc

I clean, I Build:

 Build: Debug in testMyPatience ---------------

Compiling: testMyPatienceApp.cpp
Compiling: testMyPatienceMain.cpp
Compiling: resource.rc
Linking executable: bin\Debug\testMyPatience.exe
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw28
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
1 errors, 0 warnings
 
Every time...

is lwxmsw28 a generated intermediate? switch? Is this something to do with msw setup? Is there something fundamental about msw, wxWidgets and Code::Blocks enviro vars I am missing that is obvious here?

I find it worrisome that there is no matching Debug/Release configuration being found in the wxWidgets directory. I'm just so glad I didn't try to set up wxWidgets in MSVS!

Any thoughts good and insightful people?
thanks
dp

MS Windows 7 Home Premium 64-bit SP1
Pentium Dual-Core CPU E5800 @ 3.20 GHz, 3.0 GB RAM, Intel G45/G43 Express Chipset
Code::Blocks release 10.05
mingw32 GNUMAKE 3.81
wxpack 2.8.8.4 used
c:\wxWidgets-2.8.12
c:\MinGW

Offline dprowse

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code::Blocks compile issue with wxWidgets
« Reply #1 on: September 04, 2011, 06:51:39 pm »
oops...
Under Global compiler settings -> Toolchain executables -> Compiler's installation directory ... MinGW path is set as..
C:\Program Files (x86)\CodeBlocks\MinGW

I do have a copy under c:\MinGW.

I occurs to me now, do I have to set computer %PATH% with this "C:\Program Files (x86)\CodeBlocks\MinGW
" as well?

all other Program Files are set properly here as far as I can see.
tnx.
dp

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Code::Blocks compile issue with wxWidgets
« Reply #2 on: September 04, 2011, 07:17:07 pm »
oops...
Under Global compiler settings -> Toolchain executables -> Compiler's installation directory ... MinGW path is set as..
C:\Program Files (x86)\CodeBlocks\MinGW

I do have a copy under c:\MinGW.

I occurs to me now, do I have to set computer %PATH% with this "C:\Program Files (x86)\CodeBlocks\MinGW
" as well?

all other Program Files are set properly here as far as I can see.
tnx.
dp

If you want to use the MinGW shipped with C::B (below C::B isnatallation directory), you have to remove (or rename) all existant \MinGW-folders on any drive, otherwise, you might run into trouble, because MinGW has it hardcoded and uses libraries from there if it exists.

Also you should read this ( http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef ) to get wxWidgets properly compiled.
NOrmally it works out of the box, without the need to copy setup.h (if you compile wxWidgets with the appropriate makefile).

Offline dprowse

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code::Blocks compile issue with wxWidgets
« Reply #3 on: September 04, 2011, 08:14:35 pm »
Quote
because MinGW has it hardcoded and uses libraries from there if it exists.

Of course...I should have thought of this...this is where I will restart...

You link:
http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#wxWidgets_Build_Options_Explained

describes pretty much what I did except: the information on release and debug wrt "libwxmsw28x.x" is what I was missing. No excuse oversight.

When I get back from fishing I will most likely just do a clean install with MinGW renamed and %PATH% removed from env on my system and use C::B install directory for the duration.

I'll post back if this works.

Your direction is greatly appreciated.
Best regards,

dp

Offline dprowse

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code::Blocks compile issue with wxWidgets
« Reply #4 on: September 04, 2011, 10:27:59 pm »
Hmm...renamed c:\MinGW to c:\MinGW_orig and reopened C::B, reloaded last project and same issue.


-------------- Build: Release in testMyPatience ---------------

Compiling: testMyPatienceApp.cpp
Compiling: testMyPatienceMain.cpp
Compiling: resource.rc
Linking executable: bin\Release\testMyPatience.exe
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw28
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
1 errors, 0 warnings
 
I note that the path to MingGW is to C::B as you state should be.

Incase the was embedded issues with last projecct I created a new one:

-------------- Build: Debug in testMyPatience02 ---------------

Compiling: testMyPatience02App.cpp
Compiling: testMyPatience02Main.cpp
Compiling: resource.rc
Linking executable: bin\Debug\testMyPatience02.exe
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw28d
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
1 errors, 0 warnings

Ok, next step, uninstall, clean up and try again.

dp

Offline dprowse

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code::Blocks compile issue with wxWidgets
« Reply #5 on: September 04, 2011, 11:10:04 pm »
Ok. I uninstalled all wxwidget setups etc. additions you name. Uninstalled C::B. Ran ccleaner (as it is all i have now to automate reg ref cleanup.)

Reinstalled C::B. (codeblocks-10.05mingw-setup)

Reinstalled wxWidgets (wxPack_v2.8.8.04)

Had no fun finding wxWidget directory after startup of C::B. I was looking in C::B directory as this (oddly) is were MinGW is ensconced.

After remembering seeing the source code going into c:\...\sourcecode\...\ something or other on install I searched...

after directing project set up to C:\SourceCode\Libraries\wxWidgets2.8 accepting most defaults I have compile on basic window.

I would have prefered to have compilation with MinGW from C:\MingGW and using C:\wxWidgets2.8.xx directly but this will do for now.

Thanks Jens for your help. You are doing an excellent job moderating what I see as a challenging topic.

br
dp