The problem of using Eclipse to run libcrafter examples

206 views
Skip to first unread message

legend...@gmail.com

unread,
May 9, 2013, 9:34:35 AM5/9/13
to libcr...@googlegroups.com
I want to know whether we can run libcrafter examples under Eclipse with CDT installed?  I have successfully run examples under the terminal according to the guides. But when I run these examples under Eclipse, errors occur. The error message is:
/crafter-example/Debug/../src/main.cpp:17: undefined reference to `Crafter::RawLayer::RawLayer(char const*)'

ps: "#include <crafter.h>", "using namespace Crafter;" shows no error.

Esteban Pellegrino

unread,
May 9, 2013, 12:35:08 PM5/9/13
to libcr...@googlegroups.com
Yes is possible, I do it all the time.

I usually start with a C++ project using the "Linux GCC" toolchain. Then I Right-Click into the project, go to Properties -> C/C++ Build -> Settings. In the "Tool Settings" tab I add the library "crafter" (without the lib prefix) into GCC C++ Linker -> Libraries.

My guess is that you are not linking your code with libcrafter...

Best,
Esteban




--
You received this message because you are subscribed to the Google Groups "libcrafter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libcrafter+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

legend...@gmail.com

unread,
May 12, 2013, 8:40:19 AM5/12/13
to libcr...@googlegroups.com
Thanks a lot! Now I can run these examples under eclipse. However it seems that running these examples requires root permission. Should I use root privileges to start Eclipse? Or there are some other better ways?

The error message is: [!] ERROR  : CreateLinkSocket() -> Creating packet(PF_PACKET) socket: Operation not permitted

Esteban Pellegrino

unread,
May 12, 2013, 10:33:48 AM5/12/13
to libcr...@googlegroups.com
IMHO, starting eclipse as root is not a very good idea, but is the simplest solution. I think that will mess up permissions on your home folder and project path.

I usually run the programs from the console using sudo. If you need to debug the program using eclipse you can modify the sudoers file to allow gdb to run as root without asking for password. Then create an alias to run gdb as root and call it from eclipse.

Best,
Esteban

legend...@gmail.com

unread,
May 13, 2013, 10:30:31 PM5/13/13
to libcr...@googlegroups.com
Thanks for your advice! I also run the programs from the console, but the debugging is a big problem. Now I'm trying to debug it under eclipse according to your advice.
Reply all
Reply to author
Forward
0 new messages