Using wxWidgets with Visual Studio Build Tools (2019)

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
robbiegregg
In need of some credit
In need of some credit
Posts: 9
Joined: Wed Mar 22, 2017 9:27 pm

Using wxWidgets with Visual Studio Build Tools (2019)

Post by robbiegregg »

Happy new year all!

I have been using Visual Studio Build Tools 2019 to compile a release version of my wxWidgets program (in conjunction with Code::Blocks) successfully for a while. The reason for using the C++ compiler available in Build Tools (as opposed to the compiler installed with Visual Studio Community/Express/etc, which is essentially the same) is one of legality as I would like to ultimately use the compiled executable in a commercial environment. I have been led to believe that the compilers themselves are less commercially restrictive compared with Visual Studio.

Up until now, whenever I need to debug the program, I compile the same code in Ubuntu (gcc) which again works fine. However, I would like to debug the program in Windows but am unsure how best to do this. I have so far managed to compile the debug shared wxWidgets libraries using cmake:

Code: Select all

nmake /f makefile.vc BUILD=debug   SHARED=1 TARGET_CPU=X64 VENDOR=MYNAME MONOLITHIC=1
nmake /f makefile.vc BUILD=debug   SHARED=1 TARGET_CPU=X64 VENDOR=MYNAME
(Likewise, the release versions are generated using the following commands:

Code: Select all

nmake /f makefile.vc BUILD=release   SHARED=1 TARGET_CPU=X64 VENDOR=MYNAME MONOLITHIC=1
nmake /f makefile.vc BUILD=release   SHARED=1 TARGET_CPU=X64 VENDOR=MYNAME
)

If I then try to simply run the debugged executable , I get a super horrible 'Debug Assertion Failed!' window error box appearing, informing me that 'wxbase30ud_vc_MYNAME.dll' 'cannot dereference string iterator because it is out of range (e.g. an end iterator). The actual offending line of code is in C:\Program File (x86)\Microsoft Visual Studio\2019\BuildTools\VC\MSVC\14.23.28105\include\xstring (line 1815).

My gut feeling is that in order to debug a program that has used the Visual Studio Build Tools compiler (cl.exe), one requires the Visual Studio Debugger, and that no matter how hard I try, gdb won't understand the debugging symbols,etc produced. However as the VS debugger is only available in Visual Studio Community/Express/etc, I won't be able to debug the program in Windows!

I know this is a bit off topic and perhaps not the right forum to ask such a question, but does anyone know if my gut feeling is correct? Or has anyone else managed to debug a Visual Studio compiled executable using an freely available debugger (such as gdb)?

Thanks for reading, and I hope my ramblings make sense!
Last edited by robbiegregg on Sat Jan 04, 2020 4:23 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Using wxWidgets with Visual Studio Toolkit (2019)

Post by ONEEYEMAN »

Hi,
You are correct.

Thank you.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 469
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Using wxWidgets with Visual Studio Build Tools (2019)

Post by New Pagodi »

robbiegregg wrote: Sat Jan 04, 2020 12:25 pm My gut feeling is that in order to debug a program that has used the Visual Studio Build Tools compiler (cl.exe), one requires the Visual Studio Debugger, and that no matter how hard I try, gdb won't understand the debugging symbols,etc produced. However as the VS debugger is only available in Visual Studio Community/Express/etc, I won't be able to debug the program in Windows!

I know this is a bit off topic and perhaps not the right forum to ask such a question, but does anyone know if my gut feeling is correct? Or has anyone else managed to debug a Visual Studio compiled executable using an freely available debugger (such as gdb)?
Microsoft's pdb format is a proprietary format. A few years ago clang made some progress in using pdb files, but I haven't heard much recently.

Microsoft makes debugging tools freely available. There used to be a separate package, but now they're only available bundled with the windows10 sdk. Included in the package
  • cdb which is a command line tool somewhat similar to gbd
  • windbg which is a basically a gui frontend for cdb
  • kdb which I've never used.
If you know gdb well, you should be able to use cdb pretty easily. I mostly use windbg because I'm lazy.
Post Reply