wxOnAssert

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
BlueStallion60
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Feb 05, 2007 7:01 pm

wxOnAssert

Post by BlueStallion60 » Wed Feb 14, 2007 1:41 pm

I'm confused. I'm trying to put a WxLogWindow in my app, and use it primarily as a system log. I create the window in OnInit(), and then as I go into and out of classes/functions I log the occurance, and I want to drop certian varialble values into it along the way. The log window comes up, which was the easy part. Then the only way I cold get messages in it was with WxLogMessage, WxLogDebug did nothing. This is no good, as I don't want them in the release build. After searching the forums, and google, I saw that __WXDEBUG__ had to to be defined. When I put __WXDEBUG-__ in I get a bunch of wxOnAssert undefined linker error. Reading through the forums has seemed to run me in circles. I am using WxDevCPP 6.10 with the WxWidgets 2.8.0 DevPak. I read that WxWidgets has to be built in debig mode for the Log functions to work, and that WxDevCpp and the 2.8 DevPak disabled debug mode, is this true? I downloaed the 2.8 source, compiled it with debug, and tried to use those libraries, but got tons of other errors. I guess I didn't set up the debuglibrary correctly, or link to them correctly.

Thanks for the forum, and any help.

biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab » Wed Feb 14, 2007 3:24 pm

You are getting those bunch of errors as the other settings are different, such as C Runtime Library, Compiler Options etc.

I have an better alternative for you. Please visit the following forum and download and install latest Nightly of Code::Blocks.

http://forums.codeblocks.org/index.php?board=20.0

The new project wizard of Code::Blocks can handle almost all type of wx libs (Except Universal one). You have to point to the wxwidgets directory and select appropriate settings. Wizard will do the rest for you.

AFAIK, there is not much customisations options available in wxDevCPP. :)
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.

BlueStallion60
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Feb 05, 2007 7:01 pm

Post by BlueStallion60 » Thu Feb 15, 2007 12:13 am

That's nice, and CodeBlocks may be awesome. Some time when I have some time, I may try to learn it, but for now can someone give me a hand with the OnAssert undefined reference linker erros

Thanks

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Thu Feb 15, 2007 1:06 am

Sticky: Please ask wxDev-C++ related issues in the wxDev-C++ forum
If your question is wxDevCpp specific, better ask in the wxDecC++ section of the forums, people there will know how to answer more specifically

biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab » Thu Feb 15, 2007 4:06 am

biplab wrote:You are getting those bunch of errors as the other settings are different, such as C Runtime Library, Compiler Options etc.
I couldn't elaborate the issue at that time due to time constraint.

The problem is your project file is compiled in Release mode. Assuming you are using MSVC, do the following.
  1. Change compiler option /MD to /MDd
  2. Add __WXDEBUG__ as preprocessor define
  3. Add /NODEFAULTLIB:msvcrt.lib, /NODEFAULTLIB:libcmt.lib and /NODEFAULTLIB:libcmtd.lib to linker.
  4. Add msvcrtd.lib to linker as input file, if necessary
  5. Change the wx libraries. E.g, if you find wxbase28.lib to wxbase28d.lib and do this with other libs.
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.

BlueStallion60
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Feb 05, 2007 7:01 pm

Post by BlueStallion60 » Thu Feb 15, 2007 4:27 am

Thanks for the reply, but I'm using the mingw32 compiler that ships with DevCpp. I will try to work these suggestions into the project. However, when I look at the project setting I do have the Generate Debugging Info set to Yes. As for changing the libraries, I see in my libraries tab where it is using -lwxmsw28 -lwxmsw28_gl, but when I built the debug libraries, I see the libwxbase28d, but nothing named -lwxmsw28d? What's the difference?

I have the WxWidgets book, and plan to do some reading tonight. Your help is greatly appriciated.

biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab » Thu Feb 15, 2007 4:40 am

OK.
BlueStallion60 wrote:I see in my libraries tab where it is using -lwxmsw28 -lwxmsw28_gl, but when I built the debug libraries, I see the libwxbase28d, but nothing named -lwxmsw28d? What's the difference?
The difference is wxDevCPP comes with monolithic build of library whereas you've compiled the wxWidgets in Non-monolithic mode.

Remove -lwxmsw28 -lwxmsw28_gl. Then add -lwxmsw28d_core, -lwxbase28d, -lwxpngd.a, -lwxzlibd.a in place of them.

If you want to add any more libraries, the add them as -l<libname.a> or -l<name>. E.g, if you want to add libwxmsw28d_html.a, then add it as -llibwxmsw28d_html.a or -lwxmsw28d_html :)
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.

BlueStallion60
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Feb 05, 2007 7:01 pm

Post by BlueStallion60 » Thu Feb 15, 2007 5:25 am

Thanks. I just read the chapter on building and installing wxWidgets in the book, and am about to rebuild a release and debug configuration. I'll let you know how it comes out.

Post Reply