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?
That's a linking error; you're missing the util
library. Do this to build on the command line:
g++ myprogram.cpp -lutil
Eclipse should have project-level settings for listing the libraries to link against.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With