Thursday, December 15, 2011

Sunday, December 4, 2011

Setting up a project using Libcoap in Eclipse CDT

For those new to Eclipse CDT (as I am), a couple of things may be very helpful.

Look at Eclipse C/C++ and Linux Libraries for a quick tutorial on configuring Eclipse CDT.
Then look at the thread Linker cannot find lib file for how to point the linker to the appropriate library file.
This is likely all pretty obvious to an experienced C programmer, but to a newbie it may be frustrating.

So in my case, under GCC C Compiler/Includes it was necessary to define the include path to where libcoap was installed (the File Browser helps here).
Then you have to go to the GCC C Linker/Libraries dialog and declare "Libraries (-l)" with "coap" and "Library search path (-L)" again to where libcoap was installed.
Refer above:

If your library is called "libmysqlclient.a" you specify -lmysqlclient 
to the linker (it automatically adds "lib" prefix and ".a" (or ".so") 
suffix.