defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr' 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
rkamarowski
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri Jan 14, 2022 5:54 pm

defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr'

Post by rkamarowski »

VS Code
C++
Clang++
CMake
wxWidgets x86 is installed in vcpkg

main.cpp

Code: Select all

#include <iostream>
#include <wx/wx.h>

int main(int, char**) {
    std::cout << "Hello, world!\n";
}
I'm getting the following error when attempting to build:

Code: Select all

wx/defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr' (aka 'unsigned long') loses information
[build]     return reinterpret_cast<wxUIntPtr>(p);
Not sure what the problem is, and I don't want to change any wxWidgets code. Is there a work-around?
Bob K.
User avatar
doublemax
Moderator
Moderator
Posts: 17452
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr'

Post by doublemax »

First you should try to build the "minimal" sample that comes with the wxWidgets sources. If that doesn't work, your compiler setup is not correct.

You should read:
https://github.com/wxWidgets/wxWidgets/ ... install.md

And:
viewtopic.php?p=196105#p196105
(This is for Visual Studio, but it describes all the necessary prerequisites like includes paths, preprocessor symbols, etc).
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 6114
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr'

Post by ONEEYEMAN »

Hi,
On top of what doublemax said - multipe people on this forum tried to use libraries provided by vcpkg,

All those people dropped them in the end because those libraries were buggy.

I suggest you do the same and build the libraries from sources or install the official prebuilt binaries downloaded from the wxWidgets website.

Thank you.
rkamarowski
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri Jan 14, 2022 5:54 pm

Re: defs.h:1011:12: error: cast from pointer to smaller type 'wxUIntPtr'

Post by rkamarowski »

I have the binaries installed, so I'll use those. Thanks for info.
Bob K.
Post Reply