Problem with libexpat1-dev

Asked by W_Guthrie

I can't compile anything using the libexpat1-dev library, I get some kind of linking problem. For example if I try to compile the example provided in /usr/share/doc/libexpat1-dev/examples/elements.c I get the following error message

/tmp/ccYZQPO9.o: In function `main':
elements.c:(.text+0x95): undefined reference to `XML_ParserCreate'
elements.c:(.text+0xbd): undefined reference to `XML_SetUserData'
elements.c:(.text+0xdb): undefined reference to `XML_SetElementHandler'
elements.c:(.text+0x14b): undefined reference to `XML_Parse'
elements.c:(.text+0x15d): undefined reference to `XML_GetCurrentLineNumber'
elements.c:(.text+0x16d): undefined reference to `XML_GetErrorCode'
elements.c:(.text+0x175): undefined reference to `XML_ErrorString'
elements.c:(.text+0x1ba): undefined reference to `XML_ParserFree'
collect2: ld returned 1 exit status

And same goes for all applications I have written using expat which has compiled earlier.
What is the problem, I can't seem to figure it out?
/Pontus

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu expat Edit question
Assignee:
No assignee Edit question
Solved by:
Simeon Visser
Solved:
Last query:
Last reply:
Revision history for this message
Best Simeon Visser (svisser) said :
#1

You could try the suggestion in this thread (someone having the same problem):

http://www.linuxquestions.org/questions/linux-software-2/expat-xml-parser-not-working-597157/

Revision history for this message
W_Guthrie (pontusmelke) said :
#2

Yeah of course it works, I forgot the -lexpat flag to the linker. It used to work anyway before though, because I'm using the same Makefile, but never mind it works now and it makes more sense to include the -lexpat flag anyhow.

Thanks!
/Pontus