• Advertisement
Sign in to follow this  

forward declaration? Linux ok but not Win10

This topic is 411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

it compiles on Ubuntu but on win10 I get:

the Argument of Typ ""int (*)(XPWidgetMessage inMessage, XPWidgetID inWidget, long inParam1, long inParam2)"" is incompatible with parameter of Type ""XPWidgetFunc_t""

 

int InputKeyHandler(
                        XPWidgetMessage            inMessage,
                        XPWidgetID                inWidget,
                        long                    inParam1,
                        long                    inParam2);

here I get the error

    // Register our widget handler
    XPAddWidgetCallback(InputKeyWidget, InputKeyHandler);

 

Thanks in advance for any help to compile that also on Win10.

 

Share this post


Link to post
Share on other sites
Advertisement

Looks like for whathever reason in your new build environment, the XPAddWidgetCallback-function, of the library you are using takes another type of function callback (please provide the exact specifications of external libraries you are using in the future), and your InputKeyHandler is somehow incompatible.

 

Actually, what you should be doing is quite simple:

 

1) head to XPAddWidgetCallback-definition (using IDE-shortcuts ie)

2) See where "XPWidgetFunc_t" is used

3) Head over to XPWidgetFunc_t definition and see why its incompatible with the type of function you are passing in (as referenced in the error message).

 

So according to the documentation to that function pointer type:

 

http://www.xsquawkbox.net/xpsdk/mediawiki/XPWidgetFunc_t

 

XPWidgetFunc_t takes two "intptr_t" as last arguments, and your function uses "long". For some reason long was the same typedef as "intptr_t" on your original platform, but now they are different types. So optimally you just use "intptr_t" instead of "long", this should resolve the error (also thats the reason this typedef exists, for portability :) ).

 

EDIT: Sniped, darn! :)

Edited by Juliean

Share this post


Link to post
Share on other sites

Thanks, if I change long to intptr_t it compiles but gives link errors.

 

Since you didn't show the actual linker errors, a wild quess: Did you make the change at both the declaration AND definition of the callback function? If you don't, the compiler will assume those are both different functions, with the one you use in XPAddWidgetCallback lacking a definition.

Share this post


Link to post
Share on other sites

I fixed the link error by updating the x-plane sdk. But a month or so ago I needed to reinstall win 10 and now I get tons of other errors. Fun times ahead on my beloved Windows. Thanks

Edited by mike44

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement