Author Topic: Using wxWidgets  (Read 5974 times)

Offline Samuel G.

  • Multiple posting newcomer
  • *
  • Posts: 17
Using wxWidgets
« on: December 21, 2006, 01:35:37 am »
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: Using wxWidgets
« Reply #1 on: December 21, 2006, 01:55:59 am »
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
« Last Edit: December 21, 2006, 04:25:20 am by stahta01 »
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 thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Using wxWidgets
« Reply #2 on: December 21, 2006, 02:39:44 am »
was 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."

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Using wxWidgets
« Reply #3 on: December 21, 2006, 03:50:05 am »
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.

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

Offline Samuel G.

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Using wxWidgets
« Reply #4 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'
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?
« Last Edit: December 21, 2006, 11:47:04 am by Samuel G. »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using wxWidgets
« Reply #5 on: December 21, 2006, 12:47:57 pm »
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
« Last Edit: December 21, 2006, 03:33:10 pm by biplab »
Be a part of the solution, not a part of the problem.

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Using wxWidgets
« Reply #6 on: December 21, 2006, 03:25:55 pm »
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.

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.
« Last Edit: December 21, 2006, 03:29:53 pm by RJP Computing »
- Ryan

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

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using wxWidgets
« Reply #7 on: December 21, 2006, 03:44:22 pm »
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.

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Re: Using wxWidgets
« Reply #8 on: December 21, 2006, 04:10:25 pm »
Biplab,

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

...
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

Offline Samuel G.

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Using wxWidgets
« Reply #9 on: December 21, 2006, 04:53:46 pm »
My Problems are solved :) :) :)