Author Topic: Modified & Improved wxWidgets Project Wizard  (Read 240535 times)

bnilsson

  • Guest
Re: Modified & Improved wxWidgets Project Wizard
« Reply #15 on: December 26, 2006, 05:53:29 pm »
No errors this time, thanks for the fix.


Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #16 on: December 26, 2006, 06:15:53 pm »
Hi bnilsson, Thanks for your confirmation.  :D

Hi TDragon, I'm not sure why the compilers work in such a way?? If anyone have any idea, please post.

I frequently use MSVC 8 as that comes for free with a great IDE. That's why I didn't notice that. Thanks for pointing that out. Also if you go through the makefiles in wxWidgets sample directory, you'll find they have also added a number of Win32 libraries. I'm just quoting one line from minimal app's makefile for GCC.
Code: makefile.gcc
$(OBJS)\minimal.exe: $(MINIMAL_OBJECTS) $(OBJS)\minimal_sample_rc.o
$(CXX) -o $@ $(MINIMAL_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p)  -lwxzlib$(WXDEBUGFLAG)  -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32

I don't know the reason  :?
Be a part of the solution, not a part of the problem.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Modified & Improved wxWidgets Project Wizard
« Reply #17 on: December 27, 2006, 10:18:34 am »
Quote
I'm not sure why the compilers work in such a way?? If anyone have any idea, please post.

In a few simple words:

When you 're creating a DLL (e.g. foo.dll), every function that it needs from a static library (e.g. libABC.a) is embedded into the DLL. If you use that DLL later with your project and you don't use other functions from that static lib (i.e. from libABC.a) then there is no need for you to link to the static lib too.

On the other hand, when creating a static library (e.g. libfoo.a), it contains only its own symbols. If it needs symbols from another static lib (e.g. libABC.a), you have to link to it too when linking your app.

So, for wx, if you will be using the wx dll, no extra static libs are needed in linking stage. But if you use the wx lib, you need to link to all those static libs you see in the examples...

I hope that didn't complicate things more :).
Be patient!
This bug will be fixed soon...

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #18 on: December 27, 2006, 11:19:07 am »
Thanks mandrav for your excellent reply.  :D :D

It cleared my doubts.
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #19 on: December 29, 2006, 05:46:54 pm »
Here is another update of the wizard.  :D

Changes:
  • Wizard is now more clean. Adds minimum of numbers of libraries to the project depending upon user's choice.
  • No Win32 libs are added if DLL build of wx lib is selected. Huge thanks to TDragon for pointing that and Mandrav for explaining the reason.  :D
  • MSVC 8 now support wx lib dynamically linked with C Runtime Library (CRT) for all build configurations of wxWidgets. Statically linked wx lib (for MSVC 8 ) are NOT supported anymore.
  • Wizard now generates commands to embed manifest file to generated exe file after linking to load CRT properly during runtime (For MSVC 8 only). So no performance issues with wxString now. But your application will now depend upon msvcrt.dll
  • Options to select almost all the individual libs of wxWidgets in non-monolithic mode. (see the following screenshots) Please note the none of the lib from Contrib dir are added. If you need them, you have to add them manually.


Check the option, in bold, to go the next page.

One point to remember that though there is no Next button, but clicking on Finish button will move to next page (if the Add more wxWidgets libraries is selected).


If you need more, then add them here.

Please test it and post your feedback.  :D
« Last Edit: January 16, 2007, 04:01:09 pm by Biplab »
Be a part of the solution, not a part of the problem.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Modified & Improved wxWidgets Project Wizard
« Reply #20 on: December 29, 2006, 06:20:46 pm »
Works like a charm, at least as far as I've tested it (using GCC). Any of the C::B devs feel like integrating it into the main project?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Modified & Improved wxWidgets Project Wizard
« Reply #21 on: December 29, 2006, 06:33:46 pm »
Works like a charm, at least as far as I've tested it (using GCC). Any of the C::B devs feel like integrating it into the main project?

We sure will, once a few people test it and report that it works fine :).
Great job Biplab :).
Be patient!
This bug will be fixed soon...

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #22 on: December 29, 2006, 06:44:17 pm »
Works like a charm, at least as far as I've tested it (using GCC). Any of the C::B devs feel like integrating it into the main project?

We sure will, once a few people test it and report that it works fine :).
Great job Biplab :).

Thanks Mandrav  :D

I am also waiting for others to test it before I request C::B devs to integrate it. :)
Be a part of the solution, not a part of the problem.

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Modified & Improved wxWidgets Project Wizard
« Reply #23 on: December 30, 2006, 09:26:36 pm »
Well it looks great.

There is a problem that makes it so that it won't link right out of the box.

I chose everything default except I un-checked "Use wxWidgets dll".

It needs to set the Debug and Release targets policy to "Prepend target options to project options" See screen shot below.

PS. It works great when building against a dll version of wxWidgets.

[attachment deleted by admin]
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: Modified & Improved wxWidgets Project Wizard
« Reply #24 on: December 30, 2006, 11:02:12 pm »
well, I haven't looked at them. But I have one concern (will post another article about that somewhere next week), just make sure the header includes are ok, and just include what's needed.
For example the current simple wx project which is generated, it's header includes are not so nice.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #25 on: December 31, 2006, 07:09:30 am »
Well it looks great.

There is a problem that makes it so that it won't link right out of the box.

I chose everything default except I un-checked "Use wxWidgets dll".

It needs to set the Debug and Release targets policy to "Prepend target options to project options" See screen shot below.

PS. It works great when building against a dll version of wxWidgets.

Thanks Ryan for your comments.  :D

Did you check with Static lib of wx? Can you please post the problems you've faced? The only problem I've faced is with Borland C++ 5.5.1 compiler and sometimes the debug target doesn't link with static debug lib of wx. I think this is due to the exe size limit of that compiler which is around 2.5 MB. It works fine with release target.

I have added the Linker Policy you've pointed out in the wizard. Please see the following screenshot (using the revised code). Do you think it needs to be added for the Compilers too??

I am attaching the revised code with this post. The revision is that now wizard adds Target Policy to linker. :D




well, I haven't looked at them. But I have one concern (will post another article about that somewhere next week), just make sure the header includes are ok, and just include what's needed.
For example the current simple wx project which is generated, it's header includes are not so nice.

Thanks for your concern. I have modified only the wizard script, not the sample code. So I didn't remove or add anything from the sample code. But I am suggesting one change. Line no 14 of main .h should be changed.

Code: from "main.h, line 14"
DECLARE_EVENT_TABLE();

Code: to "main.h, line 14"
DECLARE_EVENT_TABLE()

The line works fine with GCC and MSVC, but not with BCC. Removing the ';' will not produce any error with GCC, BCC or MSVC.  :)

I think I should have posted this earlier.  :?

[attachment deleted by admin]
« Last Edit: December 31, 2006, 08:39:31 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Modified & Improved wxWidgets Project Wizard
« Reply #26 on: December 31, 2006, 08:33:11 pm »
Works great now. I have attached a screen shot of the settings that I used because I am not sure what you are exactly asking about when you said:
Quote
Did you check with Static lib of wx?

Quote
Can you please post the problems you've faced?
This is just a bit of the linking errors, but you get the idea.
Code
Linking executable: bin\Release\cbWizTest2.exe
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_app.o):app.cpp:(.text+0x665): undefined reference to `InitCommonControls@0'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_app.o):app.cpp:(.text+0x680): undefined reference to `OleInitialize@4'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_app.o):app.cpp:(.text+0x8be): undefined reference to `OleUninitialize@0'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_statbr95.o):statbr95.cpp:(.text+0x16f): undefined reference to `CreateStatusWindowW@16'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_droptgt.o):droptgt.cpp:(.text+0x904): undefined reference to `CoLockObjectExternal@12'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_droptgt.o):droptgt.cpp:(.text+0x91c): undefined reference to `RegisterDragDrop@8'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_droptgt.o):droptgt.cpp:(.text+0x94e): undefined reference to `CoLockObjectExternal@12'
C:\devel\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28u.a(monolib_droptgt.o):droptgt.cpp:(.text+0x971): undefined reference to `RevokeDragDrop@4'

Just a quick question for you, why do I get this message:
Quote
Precompiling header: wx_pch.h
Compiling: main.cpp
cc1plus.exe: warning: wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
when I have first compiled as a Debug target, then go and rebuild the Release target?


[attachment deleted by admin]
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2804
Re: Modified & Improved wxWidgets Project Wizard
« Reply #27 on: December 31, 2006, 08:46:31 pm »
Just a quick question for you, why do I get this message:
Quote
Precompiling header: wx_pch.h
Compiling: main.cpp
cc1plus.exe: warning: wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
when I have first compiled as a Debug target, then go and rebuild the Release target?


I get that message all the time.

Each time, I switch between debug and release, I have to do a Re-Build to rebuild the pre-compiled headers because the -g flag has been toggled.

I don't think it's a result of the new wizard.

It's really annoying.

Lately, I don't even bother creating a release target. I just turn off the -g flag and re-build. Seems just as convienent as dealing with the precompiled issue.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #28 on: January 01, 2007, 06:08:55 am »
Works great now. I have attached a screen shot of the settings that I used because I am not sure what you are exactly asking about when you said:
Quote
Did you check with Static lib of wx?

Hi Ryan, Thanks for your post.  :D

I asked the question because I have changed the wizard for wx DLL lib mode in Rev 2. In static lib mode, the wizard adds Win32 SDK libs in project scope and wx libs in target scope. If you are using DLL, it adds only wx libs in target scope but NO Win32 SDK libs are added. Though a couple of essential libs, which varies with compilers, are always added to project scope. As the policy was different, that was generating errors.

Just a quick question for you, why do I get this message:
Quote
Precompiling header: wx_pch.h
Compiling: main.cpp
cc1plus.exe: warning: wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch.h.gch: created using different flags
when I have first compiled as a Debug target, then go and rebuild the Release target?

I get that message all the time.

Each time, I switch between debug and release, I have to do a Re-Build to rebuild the pre-compiled headers because the -g flag has been toggled.

I don't think it's a result of the new wizard.

It's really annoying.

Lately, I don't even bother creating a release target. I just turn off the -g flag and re-build. Seems just as convienent as dealing with the precompiled issue.

Pecan is right. It's not the fault of new wizard. Code::Blocks adds the file, required for pre-compilation, in target scope which is compiled, but not linked. As you can see that the file is added to Debug and Release target, it is compiled twice with different flags. See the following code.
Code
<Unit filename="wx_pch.h">
<Option compilerVar="CPP" />
<Option link="0" />
<Option weight="0" />
<Option target="Debug" />
<Option target="Release" />
</Unit>

I am currently working on adding support for pre-compiled headers for Borland C++ 5.5.1 and MSVC 8. I have added the support and it works fine for my project. After some more testing I'll post the revised code. But one point to note that it doesn't use Code::Block's PCH handling system.

Another problem with the sample code provided by the wizard is that it doesn't add wx_pch.h file to CPP files. Rather it is forcefully included. To me it should be included in the CPP file itself.

Wish you all Happy New Year. :D
« Last Edit: January 01, 2007, 06:10:37 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Modified & Improved wxWidgets Project Wizard
« Reply #29 on: January 01, 2007, 06:51:02 pm »
...
Another problem with the sample code provided by the wizard is that it doesn't add wx_pch.h file to CPP files. Rather it is forcefully included. To me it should be included in the CPP file itself.
I prefer this method. It is simple, smart and makes it easy to use. Please keep it this way, or at least a setting.

...
Pecan is right. It's not the fault of new wizard. Code::Blocks adds the file, required for pre-compilation, in target scope which is compiled, but not linked. As you can see that the file is added to Debug and Release target, it is compiled twice with different flags. See the following code.
Code
<Unit filename="wx_pch.h">
<Option compilerVar="CPP" />
<Option link="0" />
<Option weight="0" />
<Option target="Debug" />
<Option target="Release" />
</Unit>
Great I don't mind the warning I just wanted to make sure that I was still using pre-compiled headers in Release.

Quote
Wish you all Happy New Year. :D
Happy New year!
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB