如何在 C++ 中使用 Z3 [英] How to use Z3 with C++

查看:69
本文介绍了如何在 C++ 中使用 Z3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 C++ 中使用 Z3,我按照安装指南 - 使用 Visual Studio 命令提示符在 Windows 上构建 Z3.

I want to use Z3 with C++, and I followed the installation guide - Building Z3 on Windows using Visual Studio Command Prompt.

我构建成功了,然后我也在系统路径中添加了构建路径.但是,当我尝试运行 example.cpp 文件.错误说 [Error] z3++.h: No such file or directory.谁能告诉我在使用 Visual Studio 命令提示符成功构建 Z3 之后我还需要做任何其他配置以便使用 C++ 运行 Z3 吗?

I built it successfully, then I also added the build path to the system path. However, I still got an error when I was trying to run the example.cpp file. The error says [Error] z3++.h: No such file or directory. Can anyone tell me is there any other configuration I need to do after building Z3 using Visual Studio Command Prompt successfully in order to run Z3 with c++?

推荐答案

您是否将 z3\src\api\c++z3\src\api 路径添加到编译时包含目录?

Did you add the z3\src\api\c++ and z3\src\api path to your include directories when compiling?

如果您使用的是 Visual Studio 项目,则需要将其添加到C++"->其他包含目录"下的项目属性中.

If you're working with a Visual Studio project, you need to add it in the project properties under "C++" -> "Additional Include Directories".

使用 cl 手动编译时,可以使用 /I[path] 命令行参数(https://msdn.microsoft.com/en-us/library/73f9s62w.aspx).

When compiling manually using cl, you can use the /I[path] command line parameter (https://msdn.microsoft.com/en-us/library/73f9s62w.aspx).

一旦您真正开始在代码中使用 z3 API,您还必须将 z3.lib 添加到您的编译中,以免收到 未定义的引用 错误.在 Visual Studio 中,如果您使用的是库的相对路径,则为链接器"->附加依赖项"和可选的附加库目录".

You will also have to add the z3.lib to your compilation once you actually start using the z3 API in your code, lest you receive undefined reference errors. In Visual Studio, that's "Linker" -> "Additional Dependencies" and optionally "Additional Library Directories" if you're using a relative path to the library.

在我的环境中,以下命令行会编译您的示例程序:cl example.cpp/IC:\tools\z3\z3-master\src\api\c++/IC:\tools\z3\z3-master\src\api C:\tools\z3\z3-master\build\libz3.lib

In my environment, the following command line gets your example program compiled: cl example.cpp /I C:\tools\z3\z3-master\src\api\c++ /I C:\tools\z3\z3-master\src\api C:\tools\z3\z3-master\build\libz3.lib

这篇关于如何在 C++ 中使用 Z3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆