【发布时间】:2016-12-20 07:24:44
【问题描述】:
我只是想编译这个文件helloworld.cpp
#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。但它给了我这个错误
/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。实际上我使用了所有的组合、排列。
【问题讨论】:
-
你在安装之前有
sudo apt-get update吗?刚刚使用存储库在 Ubuntu 14.04.4 LTS 上安装了 CVC4,示例运行正常。 -
试试
g++ helloworld.cpp -Wno-deprecated -o helloworld -lcvc4。在某些系统上,-l链接器标志需要出现在最后。