WIN32: MSVC: cannot build opencbm
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
Actually, this is not exactly a bug of VICE, but it's into the header of opencmb.
While compiling C code on Windows you can have these macros:
_WIN32 when compiling for target "Windows". Somehow, it is an intrinsic symbol.WIN32 after you have included Windows.h.WIN32 before including Windows.h, so it won't be able to find it and it will never include that, unless you define yourself WIN32 into the properties of the project._WIN32 and not WIN32.
this fix needs to be applied upstream then (anything in src/lib/ is just copied 1:1 from upstream, we don't modify those)
upstream is here: https://github.com/OpenCBM/OpenCBM
That said, why does it even work in our windows builds then, and how is it a problem in MSVC on the other hand?
I think that it works because MinGW defines both
_WIN32andWIN32(just tested), while Microsoft C compiler defines only_WIN32.However,
WIN32can be also added into the options of the preprocessor into Visual Studio, if someone wants, so this patch is not strictly required.However, it is also a good idea to signal this issue to the developers at OpenCBM, in my opinion.
Last edit: Carlo Bramini 2025-11-30
I see. I'd just add it to the options in MSVC in that case - but obviously feel free to report it to the opencbm guys :)
i actually produced a working windows build in msvc now - without touching this file. shrug
After reading your message, I also tried and you are right.
I'm 100% sure that the Microsoft C/C++ compiler doesn't define
WIN32but only_WIN32(I just tried to make a test) and in the past I was forced to do that change because an error happened.But now it works because the
WIN32macro has been added into the project file by Visual Studio, as you can see from the attached screenshot.So, it seems that the patch is no longer needed until
WIN32is defined somewhere.PS: I just read that you too were able to compile successfully with Visual Studio. Great!
ok, i am closing this :) (you might still want to notice the opencbm guys)