Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1406

Mixed _WIN32/WIN32 definitions causes compiler error over mkdir defintion in verilated.cpp in Visual Studio

Added by Benjamin Gartner 8 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Configure/Make/Compiling
% Done:

0%

Estimated time:
1.00 h

Description

I get the following compile error when compiling verilated.cpp in Visual Studio. Error C2039 'mkdir': is not a member of '`global namespace'' verilated.cpp 1783

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 c93d28050 recently, so presumably this was tested in a cygwin environment that defines both.

#if defined(WIN32) || defined(__MINGW32__)
# include <direct.h>  // mkdir
#endif
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:
#if defined(WIN32) || defined(__MINGW32__)
# include <direct.h>  // mkdir
#endif

History

#1 Updated by Wilson Snyder 8 months ago

  • Status changed from New to AskedReporter

For the fixed version did you mean?

#if defined(WIN32) || defined(_WIN32) || defined(__MINGW32__)
# include <direct.h>  // mkdir
#endif

#2 Updated by Benjamin Gartner 8 months ago

Oops.

I actually meant
#if defined(_WIN32)
# include <direct.h>  // mkdir
#endif
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!

#3 Updated by Wilson Snyder 8 months ago

  • Status changed from AskedReporter to Resolved
  • Assignee set to Wilson Snyder

You're right, these two should be changed from WIN32 to _WIN32, everywhere else _WIN32 was used.

Fixed in git towards 4.012.

#4 Updated by Benjamin Gartner 8 months ago

Thanks! Works in my environment.

#5 Updated by Wilson Snyder 7 months ago

  • Status changed from Resolved to Closed

In 4.012.

Also available in: Atom