Missing wxchar.h include in crashrpt.cpp? Topic is solved

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
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Missing wxchar.h include in crashrpt.cpp?

Post by ebyrob »

I may be doing something entirely wrong, but...

I tried to build latest 3.1.1.7 from source on Windows 7 using Visual Studio 2017. At first it seemed to mostly work but I got a strange error on command line:

Code: Select all

crashrpt.cpp
..\..\src\msw\crashrpt.cpp(170): error C3861: 'wxSscanf': identifier not found
I added

Code: Select all

#include "wx/wxchar.h"
to that file and everything continued working as normal.

Possibly there's some weird cascading error condition where a crash is supposed to get reported and instead this error crops up. Also, quite possibly my environment is just horribly messed up and crashrpt.cpp doesn't need that include at all.

Sorry if this is useless noise.
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Missing wxchar.h include in crashrpt.cpp?

Post by doublemax »

Which command line did you use?
Does it also happen if you use the project files to build?
Can you try again with the latest version from GIT?
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by PB »

First, I do not know what you mean by version 3.1.1.7, the current GIT master head defines version as

Code: Select all

#define wxMAJOR_VERSION      3
#define wxMINOR_VERSION      1
#define wxRELEASE_NUMBER     2
#define wxSUBRELEASE_NUMBER  0
#define wxVERSION_STRING   wxT("wxWidgets 3.1.2") 
Secondly, I build the master yesterday with MSVC 2017 (15.9) without any issues, in many configurations with provided nmake makefiles and also as 32-bit debug static and DLL with CMake generated MSVC 2017 project (including debugrpt sample).
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by ebyrob »

@PB - sorry it was the 7 in 7zip.

So wxWidgets 3.1.1, NOT 3.1.1.7(zip)
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by ebyrob »

> Which command line did you use?
NT batch, executing MSW makefile.vc using NMAKE.

> Does it also happen if you use the project files to build?
I don't think so.

> Can you try again with the latest version from GIT?
I will tonight. (maybe late)
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by PB »

3.1.1 libraries (DLLs) built by MSVC 2017 are officially offered for download, so it seems unlikely that there is an issue, unless it was introduced by an MSVC update which while possible is not very likely.

I would make sure the installation went OK and cleared everything before trying to rebuild.

Edit
FWIW, I could build wxWidgets 3.1.1 libraries with latest stable MSVC 2017 (Desktop Express 15.9.2). Steps to reproduce
  • Downloaded and extracted the source code (wxWidgets-3.1.1.7z)
  • Opened build\msw\wx_vc15.sln
  • Built configuration Static Debug Win32
  • Built configuration DLL Release Win32
  • Built configuration for DLL Debug x64
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by ebyrob »

The latest master from git isn't building right now, something with can't find zlib. Not sure could try again tomorrow.

The problem seems likely due to this line in wxprec.h:

Code: Select all

#ifdef WX_PRECOMP
without that including wxprec.h does pretty much nothing, so wxchar.h would not be included at all which would cause this error.

I'd been messing around with CMAKE and I believe at one point I'd even run CMAKE in the wxWidgets folder which isn't recommended. So, yes the build itself works just fine when there is no problem. I was just thinking this may be a cascading failure that occurs only during error processing since I was causing one error but seeing symptoms of another. It now seems more likely that my compiler flags were just messed up (I was missing WX_PRECOMP which must be 100% required on MS Windows or I don't think crashrpt.cpp can possibly be compiled without it as currently written).
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Missing wxchar.h include in crashrpt.cpp?

Post by New Pagodi »

ebyrob wrote:The latest master from git isn't building right now, something with can't find zlib. Not sure could try again tomorrow.
You probably didn't include the submodules from the github repo. The following 2 notes from the "Building from Git Sources" might be helpful:
Please use --recurse-submodules option with the initial git clone. If you had already cloned the repository without this option, please run git submodule update --init to also get all 3rd party libraries code.

Before building from Git sources under Windows, you need to copy the file include/wx/msw/setup0.h to include/wx/msw/setup.h. This is necessary in order to allow having local modifications to the latter file without showing it as modified, as it is not under version control.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by PB »

ebyrob wrote:I was missing WX_PRECOMP which must be 100% required on MS Windows or I don't think crashrpt.cpp can possibly be compiled without it as currently written).
I have never ever defined WX_PRECOMP anywhere, yet I have been successfully building wxWidgets since v2.9 in MANY configurations with nmake and GCC makefiles, MSVS solutions as well as CMake.
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: Missing wxchar.h include in crashrpt.cpp?

Post by ebyrob »

I'm sorry I left this topic open so long.

Just to follow up, I think I got it working for now by defining WX_PRECOMP. I don't entirely recall the outcome.
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
Post Reply