我只是想编译这个文件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。实际上我使用了所有的组合,排列。
发布于 2016-08-18 20:13:27
这似乎是行动环境的一个问题。我和r4C9rAyrd6A1都能够在本地机器上编译这个示例。具体的问题可能是OP的编译器希望在其他标志之后使用-lcvc4链接器标志,例如注释中提到的g++ helloworld.cpp -Wno-deprecated -o helloworld -lcvc4。
https://stackoverflow.com/questions/38932211
复制相似问题