对“forkpty”的未定义引用
所以我正在 Ubuntu 10.04 的 Eclipse 中开发我的项目。我有以下代码行:
#include <pty.h>
pid_t pid;
int master;
pid = forkpty(&master, NULL, NULL, NULL);
但是当我尝试在 Eclipse 中构建它时,我收到错误:
undefined reference to 'forkpty'
知道如何解决这个问题吗?
So I'm developing my project in Eclipse in Ubuntu 10.04. I have the following lines of code:
#include <pty.h>
pid_t pid;
int master;
pid = forkpty(&master, NULL, NULL, NULL);
But when I try to build it within Eclipse, I get the error:
undefined reference to 'forkpty'
Any idea how to solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要 -lutil 命令行参数(以使用 libutil 共享库)。
对于日食:
http://zetcode.com/articles/eclipsecdevelopment/
选择项目属性。展开 C/C++ 构建选项卡。选择设置。从“工具设置”选项卡中,展开“GCC C 链接器”选项。单击库。将 /usr/lib/libutil.so 添加到“库”窗口。请注意,该路径在您的系统上可能有所不同。
You need -lutil command line argument (to use libutil shared library).
For Eclipse:
http://zetcode.com/articles/eclipsecdevelopment/
Select Project Properties. Expand the C/C++ Build tab. Select settings. From the Tool Settings tab, expand the GCC C Linker option. Click on libraries. Add the /usr/lib/libutil.so to the Libraries window. Notice, that this path may be different on your system.
这是一个链接错误;您缺少
util
库。执行此操作以在命令行上构建:Eclipse 应该具有项目级设置,用于列出要链接的库。
That's a linking error; you're missing the
util
library. Do this to build on the command line:Eclipse should have project-level settings for listing the libraries to link against.
我在尝试安装 delegate
时遇到了这个问题
因此,如果您尝试
make
委托并收到错误,请编辑
maker
文件夹vimmaker/_ 中的
_-forkpty.c
文件-forkpty.c 并添加#include
I came upon this issue when I was trying to install delegate
So if you are trying to
make
delegate and getting errorso edit
_-forkpty.c
file insidemaker
foldervim maker/_-forkpty.c
and add#include <util.h>