minixml undefined reference to `mxmlNewXML'

2019-06-13 20:04发布

问题:

I am having a problem getting the minixml library pulled into my project.

I followed the documentation on minixml page here http://www.minixml.org/documentation.php/install.html

There were no errors doing the install and I see the .h file in /usr/local/include/mxml.h and the assembly file in /usr/local/lib/libmxml.a

I have included mxml.h with #define<mxml.h> and it is finding that file no problem(as there are no errors from the mini xml types such as mxml_node_t etc...

I have also been compiling with -lmxml compile flag to link the library.

gcc -lpthread -lmxml    -o...and so forth

undefined reference to `mxmlNewXML'

Here is how I call the function, which matches the prototype:

mxmlNewXML("blah");

回答1:

i am also using this library. I suggested you to compile your code like this

by installing process you will get libmxml.a in your mxml package so now link that library with its whole path

gcc path_to_thatlibrary/libmxml.a -lpthread

Edit :

in your way does your code gets succesfully compile? what error it shows?