首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用CVC4 C++ API编译代码

无法使用CVC4 C++ API编译代码
EN

Stack Overflow用户
提问于 2016-08-13 19:26:24
回答 1查看 112关注 0票数 0

我只是想编译这个文件helloworld.cpp

代码语言:javascript
复制
#include <iostream>
#include <cvc4/cvc4.h>
using namespace CVC4;
int main() {
        ExprManager em;
        Expr helloworld = em.mkVar("Hello World!", em.booleanType());
        SmtEngine smt(&em);
        std::cout << helloworld << " is " << smt.query(helloworld) << std::endl;
        return 0;
}

使用g++ helloworld.cpp -lcvc4 -o helloworld -lcvc4 -Wno-deprecated。但是它给了我这个错误

代码语言:javascript
复制
/tmp/cc9SFpL4.o: In function `main':
helloworld.cpp:(.text+0xac): undefined reference to `CVC4::ExprManager::mkVar(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CVC4::Type, unsigned int)'
collect2: error: ld returned 1 exit status

帮助!

我已经安装了CVC4,在/etc/apt/sources.list中添加了repo链接,然后调用sudo apt-get install cvc4 libcvc4-dev libcvc4parser-dev

编辑:我输入了错误的g++ helloworld.cpp -lcvc4 ...,我使用了g++ helloworld.cpp -o helloworld -lcvc4 -Wno-deprecated。实际上我使用了所有的组合,排列。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-18 20:13:27

这似乎是行动环境的一个问题。我和r4C9rAyrd6A1都能够在本地机器上编译这个示例。具体的问题可能是OP的编译器希望在其他标志之后使用-lcvc4链接器标志,例如注释中提到的g++ helloworld.cpp -Wno-deprecated -o helloworld -lcvc4

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38932211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档