tags:

views:

425

answers:

2

how can i resolve a linker error in c?

this is the error message:

undefined reference to HPDF_Page_SetRGBStroke

A: 

If you are using an external library, you have to tell the linker that it should be included. It has no means of automagically finding out what you're using there.

Using gcc you can do this by compiling the program with -llibrary.

Joey
i already downloaded a haru library and extract it and paste all the header of libharu in the 'include' directory (folder) to my compiler (dev-c++). is it right to do??
mark
A: 

Apparently, you're trying to use a routine from the libharu PDF library, and it seems you're not linking against this library.

How exactly you would resolve this depends on the toolchain you're using -- under gcc, you would have to add a -lharu option or similar to the linker options.

Martin B
i already downloaded a haru library and extract it and paste all the header of libharu in the 'include' directory (folder) to my compiler (dev-c++). is it right to do??
mark
@mark: Probably not. You will also need to compile the library sources and place the resulting library in a place where the linker can find it. Most libraries come with instructions on how to do this -- I would expect that this also applies to libharu.
Martin B
how and where can i compile the library? guide me please! thanks..
mark
@mark: libharu should come with instructions on how to compile it. I've never used it myself -- sorry...
Martin B