Anthord
Anthord

Reputation: 31

C++ and undefined reference to XML_Parser

i have the following problem, i need use expat.h library, i include the library normally:

#include <expat.h>

But when i try to create a object

XML_Parser Parser = XML_ParserCreate(NULL);

Eclipse keppler return undefined reference to XML_ParserCreate . I check the library and is included. I work with ubuntu 13.04 and g++ compiler.

any idea?

Upvotes: 2

Views: 3743

Answers (1)

user283145
user283145

Reputation:

Probably you didn't link with the library. You should add this -lexpat to the compiler`s command line. For example:

g++ main.cc -lexpat -o exe

A more advanced (and more easy to use, when you get up to speed) option would be to use pkg-config as e.g. $(pkg-config --libs expat).

Upvotes: 3

Related Questions