Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Modified & Improved wxWidgets Project Wizard
Biplab:
--- Quote from: RJP Computing 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.
--- End quote ---
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
--- Quote from: killerbot 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.
--- End quote ---
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();
--- End code ---
--- Code: (To "main.h, line 14") ---DECLARE_EVENT_TABLE()
--- End code ---
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]
RJP Computing:
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?
--- End quote ---
--- Quote ---Can you please post the problems you've faced?
--- End quote ---
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'
--- End code ---
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
--- End quote ---
when I have first compiled as a Debug target, then go and rebuild the Release target?
[attachment deleted by admin]
Pecan:
--- Quote from: RJP Computing on December 31, 2006, 08:33:11 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
--- End quote ---
when I have first compiled as a Debug target, then go and rebuild the Release target?
--- End quote ---
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.
Biplab:
--- Quote from: RJP Computing 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?
--- End quote ---
--- End quote ---
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.
--- Quote from: RJP Computing on December 31, 2006, 08:33:11 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
--- End quote ---
when I have first compiled as a Debug target, then go and rebuild the Release target?
--- End quote ---
--- Quote from: Pecan on December 31, 2006, 08:46:31 pm ---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.
--- End quote ---
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>
--- End code ---
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
RJP Computing:
--- Quote from: Biplab on January 01, 2007, 06:08:55 am ---...
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.
--- End quote ---
I prefer this method. It is simple, smart and makes it easy to use. Please keep it this way, or at least a setting.
--- Quote from: Biplab on January 01, 2007, 06:08:55 am ---...
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>
--- End code ---
--- End quote ---
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
--- End quote ---
Happy New year!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version