Author Topic: MinGW not compiling WxWidgets project  (Read 7727 times)

rnz12

  • Guest
MinGW not compiling WxWidgets project
« on: May 22, 2009, 10:45:18 am »
Hi,

I'm just starting of with C++,

I downloaded Code::Blocks 8.02 with minGW compiler and wxWidgets 2.8.10.
Problem is I cant get wxWidgets working with Code::Blocks..

What I did:
> I start a new wxWidgets project in Code::Blocks
> Version 2.8x
> I add my project title
> I skip project details
> Preferred GUI Builder I choose wxSmith, application type Dialog Based
> I select the folder where I extracted wxWidgets..
C:\wxWidgets-2.8.10
> Compiler chosen GNU GCC Compiler.
> wxWidgets Library settings I checked..
* use wxwidgets DLL.
* wxwidgets is built as a monolithic library
* Enable unicode.

when I click next I then get a warning saying:
Quote
A matching Debug configuration cannot be found in the wxWidgets directory you specified.

This means that Debug target of your project wont build.
Are you sure you want to continue with these settings ?

I click on 'YES'... when I try to build the project with build target Release.. I get an error.
Quote
||=== testWX, Release ===|
ld.exe||cannot find -lwxmsw28u|
||=== Build finished: 1 errors, 0 warnings ===|

I installed wxMSW-2.8.10
Location: c:\wxWidgets-2.8.10.

Please help !

Thanks

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: MinGW not compiling WxWidgets project
« Reply #1 on: May 22, 2009, 10:49:02 am »
This question has been asked quiet often, so a forum search should probably give you the answer.

Anyway:
You have to build wxwidgets before you can use it!
Look here: http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

Offline hurkslop

  • Single posting newcomer
  • *
  • Posts: 4
Re: MinGW not compiling WxWidgets project
« Reply #2 on: May 23, 2009, 09:31:26 pm »
Hi,

I'm starting of with C++ too and i have the same problem as you compiling wxWidgets projects.

Here is a brief historical of what i did :

1) Downloaded and Installed CodeBlocks with MinGW

2) Downloaded and Installed wxMSW-2.8.10-Setup (the exe that extracts wxWidgets)

3) compiled wxWidgets library using the command (after the change of the path etc.) "mingw32-make -f                           makefile.gcc SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=release" (after cleaning it)

4)copied setup.h to the right directory

5) Opened CodeBlocks, created a wxWidgets project, defined the path for the location of $(#wx), included  $(#wx)\lib\gcc_dll in the search directories.

6) And then i get this reccurent error :
ld.exe||cannot find -lwxmsw28ud|

7)and then looked up in the forums but not good enough obviously.

I understood that using the SHARED=0 delivers a static library (*.a) and MONOLITHIC=1 creates one big DLL.
and that to link a library , for instance $(#wx)\lib\gcc_dll\libwxmsw28u.a, I just have to link with wxmsw28u and the compiler is gonna complete the rest.

I've been trying this since 2 weeks, not continuously but almost.

Thanks for the help,

-----
Hurk

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: MinGW not compiling WxWidgets project
« Reply #3 on: May 23, 2009, 09:44:57 pm »
4)copied setup.h to the right directory

Never move setup.h !!!

If you do so, you will most likely break your wxWidgets build.
There is a setup.h for each compiled library and it is in the correct place.

Read the tutorial (I posted the link before) or use the wxWidgets part from the nightly cookbook (http://wiki.codeblocks.org/index.php?title=Nightly_Cookbook).
It is normally straightforward.

And again never move setup.h.

If someone tells you, that it has to be done, he lies !

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: MinGW not compiling WxWidgets project
« Reply #4 on: May 23, 2009, 10:07:51 pm »
4)copied setup.h to the right directory

Never move setup.h !!!

If you do so, you will most likely break your wxWidgets build.
There is a setup.h for each compiled library and it is in the correct place.

Read the tutorial (I posted the link before) or use the wxWidgets part from the nightly cookbook (http://wiki.codeblocks.org/index.php?title=Nightly_Cookbook).
It is normally straightforward.

And again never move setup.h.

If someone tells you, that it has to be done, he lies !

I agree with the above and add never edit or rename setup0.h.
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 hurkslop

  • Single posting newcomer
  • *
  • Posts: 4
Re: MinGW not compiling WxWidgets project
« Reply #5 on: May 23, 2009, 10:23:38 pm »
So now what should i do? a build=release clean and build back the release?

PS : i am sorry for these questions, I know that it's redundant but I didn't find my answer.
I followed the nightlybook (NightlyBuild,install of MinGW, wxWidgets) but wasn't able to make the final "codeblocks with wxWidgets compilation" : When the project is compiled, a pop-up asks what the target is (src,sqlplus, scintilla...), I tried all the possibilities but none of them was right.
I tried then to build wxWidgets library from CodeBlocks' MinGW but here, i got the -lwxmsw28u error message.


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: MinGW not compiling WxWidgets project
« Reply #6 on: May 23, 2009, 10:44:44 pm »
So now what should i do? a build=release clean and build back the release?

PS : i am sorry for these questions, I know that it's redundant but I didn't find my answer.
I followed the nightlybook (NightlyBuild,install of MinGW, wxWidgets) but wasn't able to make the final "codeblocks with wxWidgets compilation" : When the project is compiled, a pop-up asks what the target is (src,sqlplus, scintilla...), I tried all the possibilities but none of them was right.
I tried then to build wxWidgets library from CodeBlocks' MinGW but here, i got the -lwxmsw28u error message.



Did YOU build wxWidgets using the proper method; the proper method does NOT use Code::Blocks!

At this point in time do not try to run Code::Blocks from inside Code::Blocks!

Please post link to directions you are following
I use the below link, but they might not be the best.
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows

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 stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: MinGW not compiling WxWidgets project
« Reply #7 on: May 23, 2009, 10:56:01 pm »
6) And then i get this reccurent error :
ld.exe||cannot find -lwxmsw28ud|

Thanks for the help,

-----
Hurk

The library wxmsw28ud is the Unicode Debug version of wxWidgets.

Your command below is wrong; because you are trying to use an DLL build SHARED must equal 1 instead of zero.
Code
mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=release

Try doing both of these
Code
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
mingw32-make -f makefile.gcc BUILD=debug  SHARED=1 MONOLITHIC=1 UNICODE=1

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 hurkslop

  • Single posting newcomer
  • *
  • Posts: 4
Re: MinGW not compiling WxWidgets project
« Reply #8 on: May 24, 2009, 12:03:00 am »
I am currently compiling it with the command i found on the link you sent :

mingw32-make -f makefile.gcc USE_XRC=1 MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release
and same for the debug

My sources untill now were :

http://wiki.codeblocks.org/index.php?title=Nightly_Cookbook

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

And why is USE_XRC=1 used?

But another question comes to in the link you sent stahta01, in the next step, i have to build codeblocks, using codeblocks. To do this, I have to use the NightlyBuild isn't it?

Thanks for your help guys ;)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: MinGW not compiling WxWidgets project
« Reply #9 on: May 24, 2009, 12:37:01 am »
And why is USE_XRC=1 used?

It now defaults to being 1 in the past it must have default to 0.



But another question comes to in the link you sent stahta01, in the next step, i have to build codeblocks, using codeblocks. To do this, I have to use the NightlyBuild isn't it?

No, you can use Code::Blocks 8.02 to build the Nightly Build of Code::Blocks.
You can also use a more recent, after 2008-02, Nightly Build of Code::Blocks; some of them have may not work if that nightly has a major bug it it.

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 hurkslop

  • Single posting newcomer
  • *
  • Posts: 4
Re: MinGW not compiling WxWidgets project
« Reply #10 on: May 24, 2009, 04:03:51 am »
Hi again,
I finally built CodeBlocks! (and successfully compiled wxWidgets by the way)
thanks!

Offline Lefteris

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: MinGW not compiling WxWidgets project
« Reply #11 on: May 25, 2009, 07:17:44 pm »
Hello all,

I hope it is okay to reply to this post since I am having problems compiling wxWidgets with Mingw. I am running Windows xp and the last thing I get when compiling with the commands given in the http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows tutorial is:

Code
windres --use-temp-file -i../../src/msw/version.rc -ogcc_mswudll\monodll_version
_rc.o    --define __WXMSW__      --define _UNICODE   --include-dir ..\..\lib\gcc
_dll\mswu --include-dir ../../include --define WXDLLNAME=wxmsw28u_gcc_custom --i
nclude-dir ../../src/tiff --include-dir ../../src/jpeg --include-dir ../../src/p
ng --include-dir ../../src/zlib  --include-dir ../../src/regex --include-dir ../
../src/expat/lib --define wxUSE_BASE=1 --define WXMAKINGDLL
gcc: _spawnvp: No such file or directory
windres: gcc exited with status 1
mingw32-make: *** [gcc_mswudll\monodll_version_rc.o] Error 1

Does anyone have any idea what this might be? I can't find the answer by googling. Thanks in advance.


Edit:DISREGARD My post!!! I was not setting the path correctly. I included only the mingw/bin directory while I also needed to include mingw/mingw32/bin directory in the path too.

Now it seems to have compiled. The result is the .dll in the \lib\ folder of my wxwidgets folder I presume? Oh I am so excited ! :)

« Last Edit: May 25, 2009, 08:33:16 pm by Lefteris »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: MinGW not compiling WxWidgets project
« Reply #12 on: May 25, 2009, 08:35:10 pm »
My Goggling of
Quote
gcc: _spawnvp: No such file or directory
implies a poorly built or installed GCC. The above is based on a quick look based on 3 of many Goggle results.

I suggest reinstalling MinGW GCC.

Where did you get your MinGW GCC?
What version is it?

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 Lefteris

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: MinGW not compiling WxWidgets project
« Reply #13 on: May 25, 2009, 08:43:19 pm »
Thank you for your reply stahta01 but it seems I was not setting the whole path that the compiling of wxWidgets library needed. Now it finished succesfully or at least that's what I think. I got just one .dll since I built it with MONOLITHIC option on. I must admit it feels strange to me since for the last GUI-intensive project I had written I had used wxPack and it had many different .dlls.