Join GitHub today
Mixed _WIN32/WIN32 definitions causes compiler error over mkdir defintion in verilated.cpp in Visual Studio #1406
Author Name: Benjamin Gartner
Original Assignee: Wilson Snyder (@wsnyder)
I get the following compile error when compiling verilated.cpp in Visual Studio.
The offending code seems to be here. Visual Studio defines _WIN32 and not WIN32 so it doesn't include direct.h and has no definition for mkdir. Looks like this was added in changeset c93d280 recently, so presumably this was tested in a cygwin environment that defines both.
Easy enough to define WIN32 in Visual Studio, but probably confusing to figure out that's what's needed. Probably as easy as changing to the following, assuming this doesn't break on cygwin environments:
Original Redmine Comment
I actually meant
because I'm not sure why we need to check WIN32 || or MINGW32 here. Everywhere else in the codebase uses the symbol _WIN32 and that worked fine for me when I built it under MSYS2, but I'm no expert on cygwin. But your proposed version would certainly fix the issue under Visual Studio. I just don't know if the other boolean terms are actually necessary.
Thanks for the response!