Trying to get EPANET 3 on Visual Studio to work

Hello All!

This very simple chunk of EPANET 3 code does not seem to work. I’m hoping someone who has gotten the EPANET 3 library to work (or anyone for that matter) can tell me where I went wrong.

As you can see, it returns an error code and crashes after I try to load a project. The error code, converted to hexadecimal, is C000 0005, which appears to refer to an access violation.
I’m sure the path to the INP file is correct.
I built the code from the epanet-dev github using the instructions for Windows & Visual Studio.
Moreover, I’m using Visual Studio 2017 Community with CMake 3.17.3 and MSBuild version
I added the .lib file to the project, added its path to the Library Directories in Properties, and added the .dll file to the Environment section under Properties->Debugging. (As well as put the .dll file in the same folder as the solution.)

Any help would be greatly appreciated.


Here’s what I recommend:

  • Download the develop branch as the master has bugs in it.
  • Unzip the file into a new folder.
  • Create a new sub-folder named build and cd to it.
  • Issue the following commands with cmake to build the DLL:
    cmake ..
    cmake --build . --config Release

The DLL and .lib files will be in the build\bin\Release folder.

Please note that EPANET-dev (aka EPANET 3) should not be used in any production code yet as it is strictly a developmental project and has not been properly vetted. If you need to use EPANET for a particular project I recommend that you use EPANET 2.2 which has been thoroughly tested and contains most (or all) of the same features currently included in EPANET-dev.