Motorhead
Motorhead

Reputation: 968

Having trouble building Z3 in Visual Studio

Hello I downloaded Z3 from http://z3.codeplex.com/ and then opened the Z3 solution in Visual Studio 2012. (While I'm not totally new to VS I haven't used it in over 10 years). There are 9 projects in this solution but I am having a hard time telling which I ought to be using. I can guess at some of them, but others aren't very clear. Eg. what is the difference between Microsoft.Z3 and Microsoft.Z3V3 ? Can anyone briefly explain what the different projects are and which ones to build?

Anyway just for kicks I tried building the top level solution but got the following errors

Error 1 error RC1015: cannot open include file 'afxres.h'. C:\Projects\z3-src-4.1.2\z3\dll\dll.rc 10 1 dll

Error 2 (same as Error 1 except in shell.rc)

Error 3 error LNK1104: cannot open file 'C:\Projects\z3-src-4.1.2\z3\Debug\z3_dbg.lib' C:\Projects\z3-src-4.1.2\z3\test_capi\LINK test_capi

Trying to build just the MS.Z3 project still gives me Error 1.

My eventual goal is to invoke Z3 from say an F# program. Can someone provide some guidance for how to do this? Any help would be appreciated.

Upvotes: 3

Views: 1346

Answers (1)

Leonardo de Moura
Leonardo de Moura

Reputation: 21475

EDIT

This answer reflects the directory structure used in Z3 version <= 4.1.1. In version 4.3, the code base has been reorganized/simplified.

END EDIT

Which version of Visual Studio are you using? I'm asking because I want to reproduce the behavior you described. The easiest way to build Z3 is described here. You should use the Visual Studio Command Prompt, and execute msbuild. It seems you tried that, and got errors. Here is a short description of each project folder:

  • lib: the Z3 source code is here. This is the important folder. For visual studio users, it generated a static library.
  • dll: project for wrapping the static library as a Windows DLL. This is irrelevant for users in other platforms.
  • shell: uses the static library from lib to build z3.exe.
  • test: a bunch of unit tests. It produces test.exe.
  • Microsoft.Z3: .Net API. It is the official .Net API (C#, Visual Basic, F#, etc) for Z3. This is the API you should use with F#.
  • Microsoft.Z3V3: It is the old .NET API. It was the API available in Z3 3.x. We maintain it because some users still use it.
  • test_capi: Application that tests the Z3 C API.
  • maxsat: Small application that implements two maxsat algorithms on top of the Z3 API.

Upvotes: 3

Related Questions