cxbx-shogun icon indicating copy to clipboard operation
cxbx-shogun copied to clipboard

MFPtoFP<XTL::EmuThis>(XTL::EmuThis::Emusocket), compiling error in VS2015

Open jackchentwkh opened this issue 9 years ago • 5 comments

Hi, Echelon9, I tried to compile cxbx under VS2015 community, but it gave me a error with the template function

MFPtoFPXTL::EmuThis(XTL::EmuThis::Emusocket),

stating that the MFPtoFP is not a known overload function, and "XTL::EmuThis::Emusocket" is not a correct way to get the member function pointer, the right way should be using '&' operator. how did you manage to get this template class and member function pointer access compiled in your compiler? Is there anything I should setup in my compiler options?

jackchentwkh avatar Jan 04 '16 02:01 jackchentwkh

Hello, Thanks for trying the code out and clearly reporting a error.

I'm yet to build Cxbx with a VS2015-based Microsoft compiler, so this certainly could be a valid error that the newer MS compilers are being more strict about.

As you'd know the Cxbx source code has had a number of active developers over the years. I don't believe I've ever touched that section of code, so I'm unfamiliar with it. Unfortunately, my development environment is out of reach for a few more weeks.

Perhaps the less subtle way of saying that is, 'I'd be happy to review a patch from you'.

Echelon9 avatar Jan 04 '16 03:01 Echelon9

I would be glad to let you review my code. but I have to be able to compile a working binary for my self to test it first. Caustik used this approach as a dirty trick which is not allowed in standard C++ grammar. because the member function is referenced dynamically, it's not a static pointer. but it worked in older version of VS. I tried to revised it per VS2015's suggestion.

MFPtoFPXTL::EmuThis(&XTL::EmuThis::Emusocket),

and it passed the compile stage finally though i don't know whether the result is the same or not. but I tried many different way s to work around and what's odd is that in c++ grammar the member function pointer should be accessed with the '&' operator.

now there comes new problem with linking, two errors are threw out by the linker:

cxbxkrnl project: the xd3d8lib referenced to external _snprintf and _vsnprintf, linker couldn't find related entries of these two functions.

this might be introduced by the version difference between the compiler compiled directX 8 sdk and VS2015. So far I don't have any clue how to solve it. I know step back to earlier VS would solve it, but I want to compile cxbx for newer OS such as win10 X64 I am using now.

jackchentwkh avatar Jan 04 '16 06:01 jackchentwkh

ok, I found the answers for the unresolved external symbol. simply include the legacy_stdio_definitions.lib in the linker, and it will work. this is a work around provided by MS.

now the built cxbx can run under my win10 X64, but after starting the emulation, cxbx will hang will writing the exe file. I am going to dig into this.

btw, the libjpeg also needs to be updated.

jackchentwkh avatar Jan 04 '16 08:01 jackchentwkh

damn, I made a big mistake. even I can build and run cxbx under win10 x64, the emulation won't work anyway since the emulation require directx 8, and windows 10 only have direct x 11 and 12. so this means unless I do a massive change to advance the directx modules to newest, or I won't be able to use it at all.

jackchentwkh avatar Jan 04 '16 10:01 jackchentwkh

issue also exists in Visual Studio 2013.

Volkanite avatar Jun 04 '16 15:06 Volkanite