News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Using wxWidgets

Started by Samuel G., December 21, 2006, 01:35:37 AM

Previous topic - Next topic

Samuel G.

Hello :D :D :D


I installed wxWidgets via wxPack. I want to use it in the nightly build 3398.

After hours of searching wiki.codeblocks and the forums I was not able to find out, how to set the global variable "wx" correctly to make wxWidgets Projects.

stahta01

#1
What project is NOT working?

Note, you can NOT use wxPack DLLs to build Code::Blocks to my knowledge because Code::Blocks requires an Monolithic DLL and I do NOT think wxPack supplies a Monolithic DLL.

Correction: I was wrong wxPack does have an Monolithic DLL called wxmsw26u_gcc.dll that should work to build Code::Blocks.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

thomas

Quote from: Samuel G. on December 21, 2006, 01:35:37 AMwas not able to find out, how to set the global variable "wx" correctly to make wxWidgets Projects.
Whatever is the location of your wxWidgets installation.

If you have a "normal" layout, it suffices to set the base directory (for example D:\wxWidgets).

If your headers and libraries are in "strange locations" (for example, headers are in C:\wx and libraries are in F:\libs\wx) then you have to set the include and lib members of the #wx variable to the respective correct locations. This is most unusual, though.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

RJP Computing

Samuel,

There is a great tutorials section right on wxPack's website. It has the step by step directions for using Code::Block.

There is a problem with the current Code::Blocks wxWidgets wizard that makes it complain if you use any other version of wxWidgets that isn't 2.6. Also it seems to be not including 'Comdlg32' in the linker libraries.

Quote from: stahta01 on December 21, 2006, 01:55:59 AM
Note, you can NOT use wxPack DLLs to build Code::Blocks to my knowledge because Code::Blocks requires an Monolithic DLL and I do NOT think wxPack supplies a Monolithic DLL.
FYI. wxPack does include monolithic static libraries as well as dll versions of wxWidgets. I am not sure because I have not tried to use then to build Code::Blocks, but I assume there should be know problem. It isn't like building it for Code::Blocks has any special instructions.
- Ryan

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

Samuel G.

#4
Thanks for your engangement. It was helpful, but still I am not able to build a wxWidgets-Application.

I set the variable "wx" (I did not set the values lib and include, I think this is not necessary (?)). Then I started the Wizzard for a wxWidgets-Project. (I knew the tutorial, but it I was confused whether I had to set the values lib, include and to which value). I want the Project to use wxWidgets as a static library, so I guess it was right to make the following selection:

Use wxWidgets DLL: No
wxWidgets is build as a monolithic library: Yes
Enable Unicode: Yes
Use the debugging libraries: NO
Create and use precompiled header: Yes

In the linker options I change libwxmsw26u.a to libwxmsw27u.a. When I build, I get the following errors (build log)
Quote-------------- Build: Debug in Test ---------------
Precompiling header: wx_pch.h
Compiling: main.cpp
Compiling: app.cpp
Linking console executable: bin\Debug\Test.exe
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_colordlg.o):colordlg.cpp:(.text+0xd11): undefined reference to `ChooseColorW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_fontdlg.o):fontdlg.cpp:(.text+0x372): undefined reference to `ChooseFontW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_printdlg.o):printdlg.cpp:(.text+0x11ca): undefined reference to `PrintDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_printdlg.o):printdlg.cpp:(.text+0x2649): undefined reference to `PrintDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_printdlg.o):printdlg.cpp:(.text+0x37e1): undefined reference to `PageSetupDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_printdlg.o):printdlg.cpp:(.text+0x3826): undefined reference to `PageSetupDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_filedlg.o):filedlg.cpp:(.text+0xce2): undefined reference to `GetSaveFileNameW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_filedlg.o):filedlg.cpp:(.text+0xcfc): undefined reference to `CommDlgExtendedError@0'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_filedlg.o):filedlg.cpp:(.text+0xd14): undefined reference to `GetOpenFileNameW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_dcprint.o):dcprint.cpp:(.text+0x655): undefined reference to `PrintDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_dcprint.o):dcprint.cpp:(.text+0xed2): undefined reference to `PrintDlgW@4'
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_dcprint.o):dcprint.cpp:(.text+0x1212): undefined reference to `PrintDlgW@4'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 21 seconds)
0 errors, 0 warnings

Do I also have to add include or lib directories in the "compiler and debugger" settings?

Biplab

#5
It seems that you are using wrong build target. Change your build target to Release.

I am currently working on modifying the wxWidgets App wizard in Code::Blocks. The work is not complete yet, but it gives you options of choosing wxWidgets 2.6 or wxWidgets 2.8. See the following screenshot.



The modified wizard has been tested with GCC and Borland. It is not properly working with MSVC 8. Once it is complete I'll upload patch to Berlios. I'm trying to clean and improve the wizard.

:D
Be a part of the solution, not a part of the problem.

RJP Computing

#6
Quote from: Samuel G. on December 21, 2006, 11:36:45 AM
Thanks for your engangement. It was helpful, but still I am not able to build a wxWidgets-Application.

I set the variable "wx" (I did not set the values lib and include, I think this is not necessary (?)). Then I started the Wizzard for a wxWidgets-Project. (I knew the tutorial, but it I was confused whether I had to set the values lib, include and to which value). I want the Project to use wxWidgets as a static library, so I guess it was right to make the following selection:

Use wxWidgets DLL: No
wxWidgets is build as a monolithic library: Yes
Enable Unicode: Yes
Use the debugging libraries: NO
Create and use precompiled header: Yes

In the linker options I change libwxmsw26u.a to libwxmsw27u.a. When I build, I get the following errors (build log)
Quote-------------- Build: Debug in Test ---------------
Precompiling header: wx_pch.h
Compiling: main.cpp
Compiling: app.cpp
Linking console executable: bin\Debug\Test.exe
H:\wxWidgets2.7\lib\gcc_lib/libwxmsw27u.a(monolib_colordlg.o):colordlg.cpp:(.text+0xd11): undefined reference to `ChooseColorW@4'
...
0 errors, 0 warnings

Do I also have to add include or lib directories in the "compiler and debugger" settings?
Yup I made a comment about that in my reply to you. The wizard is leaving out the library 'Comdlg32' in the linker settings. Just add it to the "Build Options->Linker->Link Libraries"

I updated the tutorial as well.

Quote from: biplab on December 21, 2006, 12:47:57 PM
I am currently working on modifying the wxWidgets App wizard in Code::Blocks. The work is not complete yet, but it gives you options of choosing wxWidgets 2.6 or wxWidgets 2.8. See the following screenshot.
Looks great. This is a needed addition. Thanks.
- Ryan

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

Biplab

Hi Ryan,

The present form of the wizard script supports GCC (MinGW Build) and MSVC 7.1 (it seems to me) properly. But it supports Monolithic build properly. For other builds of wxWidgets, the support is not good. I am trying to add support for other Compilers, namely Borland C++ Compiler 5.5.1 and MSVC 8 (I know you don't prefer it, we had a discussion on this in wxPack forum  :)) and as well as improving support for other wx builds.

The Borland support is quite complete right now. But the wizard generates Debug target in a different way. So the debug target is creating problem for Borland compiler. I have already posted the problem in this forum.  :D
Be a part of the solution, not a part of the problem.

RJP Computing

Biplab,

Yes I agree the support is almost perfect, but the selection dialog is going to be great! Keep up the good work.

Quote from: biplab on December 21, 2006, 03:44:22 PM...
I am trying to add support for other Compilers, namely Borland C++ Compiler 5.5.1 and MSVC 8 (I know you don't prefer it, we had a discussion on this in wxPack forum  :)) and as well as improving support for other wx builds.
Oh I like MSVC 8.0 just not there dll manifest requirement. :)
- Ryan

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

Samuel G.