【发布时间】:2014-10-23 17:15:09
【问题描述】:
最近我发现了一个example,介绍了如何在 C++ 中使用 expect 库。我试图编译它,但编译器(g++)说,tcl8.5/expect.h 不存在。所以我尝试包含 tcl8.6/expect.h - 仍然是同样的错误。我检查了 /usr/include/ 目录,当我注意到没有 tcl8.x 目录时我并不感到惊讶。 我搜索了名称中带有“expect”的文件。这是我发现的:
/usr/include/expect_tcl.h
/usr/include/expect_comm.h
/usr/include/expect.h
不幸的是,当我尝试包含其中任何一个时,我在编译期间得到了以下错误列表:
> g++ test.cpp -Wall -std=c++0x -ltcl8.6 -lglog -o test
/tmp/cce8k1BA.o: In function `task(std::string const&, std::string const&, std::string const&)':
test.cpp:(.text+0x16): undefined reference to `exp_is_debugging'
test.cpp:(.text+0x20): undefined reference to `exp_timeout'
test.cpp:(.text+0x38): undefined reference to `exp_popen'
etc...
我该如何解决这个问题?
[编辑] 当我尝试将其与期望库(-lexpect)链接时,出现以下错误:
/usr/bin/ld: cannot find -lexpect
collect2: error: ld returned 1 exit status
我确定 - tcl8.6 和 expect 5.45-4 都已安装。
【问题讨论】:
标签: c++ c tcl expect include-path