Re: [xml] Trouble compiling a library

You should probably start with an intro to C programming course.  This isn't the place for newbie questions.

On Jul 11, 2012, at 11:03 AM, michael jerusalmi steria com wrote:

I discovered libxml a few weeks ago, and after a few days playing with it, I decided to build my own 
library using libxml.
I have my lib.c and my lib.h files ready to be compiled.

Problem, I'm having issues to compile them, as I'm overwhelmed with error messages during the compilation.

Here is the content of my folders :

my root : /home/emmji/tmp/xml

----/libxml2-2.7.8 (kept intact since installation)
                ----/ (all the .h files)
          ---- Makefile
          ---- (all the rest ...)
     ----/ (all the rest ...)
----/xmlinst (the installation folder)
---- lib.c
---- lib.h

My lib.h contains : 
#include <stdio.h>
#include <string.h>
#include "libxml2-2.7.8/include/libxml/parser.h"
#include "libxml2-2.7.8/include/libxml/tree.h"

and my lib.c : 
#include "lib.h"

The problem is that I don't understand what's going on : is there a problem with libxml itself (i doubt 
it)? is there a problem of path in my declaration ? why for example, in parser.h, tree.h is linked as 
"libxml/tree.h" (because like that, it's normal that it's not found...) ? Do I miss a environment variable 
somewhere ?

I put at the end of my message a part of the errors : 

Thanks for your help.



[emmji xml]$ gcc -c lib.c
In file included from lib.h:25,
                from lib.c:24:
libxml2-2.7.8/include/libxml/parser.h:15:31: error: libxml/xmlversion.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:16:25: error: libxml/tree.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:17:25: error: libxml/dict.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:18:25: error: libxml/hash.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:19:26: error: libxml/valid.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:20:29: error: libxml/entities.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:21:29: error: libxml/xmlerror.h: No such file or directory
libxml2-2.7.8/include/libxml/parser.h:22:30: error: libxml/xmlstring.h: No such file or directory
In file included from lib.h:25,
                from lib.c:24:
libxml2-2.7.8/include/libxml/parser.h:52: error: expected ')' before '*' token
libxml2-2.7.8/include/libxml/parser.h:56: error: expected specifier-qualifier-list before 
libxml2-2.7.8/include/libxml/parser.h:187: error: expected specifier-qualifier-list before 'xmlDocPtr'

(... many others errors on parser.h ...)

libxml2-2.7.8/include/libxml/parser.h:1174: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
libxml2-2.7.8/include/libxml/parser.h:1229: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
In file included from lib.h:26,
                from lib.c:24:
libxml2-2.7.8/include/libxml/tree.h:35: error: conflicting types for 'xmlParserInputPtr'
libxml2-2.7.8/include/libxml/parser.h:801: error: previous declaration of 'xmlParserInputPtr' was here
libxml2-2.7.8/include/libxml/tree.h:88: error: expected specifier-qualifier-list before 'xmlChar'

In file included from lib.h:26,
                from lib.c:24:
libxml2-2.7.8/include/libxml/tree.h:294:30: error: libxml/xmlregexp.h: No such file or directory
libxml2-2.7.8/include/libxml/tree.h:310: error: expected ':', ',', ';', '}' or '__attribute__' before '*' 
libxml2-2.7.8/include/libxml/tree.h:353: error: expected ':', ',', ';', '}' or '__attribute__' before '*' 

(... many others errors on tree.h ...)

libxml2-2.7.8/include/libxml/tree.h:1213: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
libxml2-2.7.8/include/libxml/tree.h:1218: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
In file included from lib.c:24:
lib.h:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNewDoc'
lib.h:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.h:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.h:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.h:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.h:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.h:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
lib.h:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
lib.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNewDoc'
lib.c:66: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.c:90: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.c:115: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.c:141: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.c:166: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmlNodePtr'
lib.c:193: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
lib.c:218: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'

Ce message est à l'attention exclusive des destinataires désignés. Il peut contenir des informations 
confidentielles. Si vous n'êtes pas destinataire du message, merci d'en avertir immédiatement l'expéditeur 
et de détruire ce message. Le contenu de ce message ne pourrait engager la responsabilité de Steria que 
s'il a été émis par une personne dûment habilitée agissant dans le strict cadre de ses fonctions et à des 
fins non étrangères à ses attributions. Bien que les meilleurs efforts soient faits pour maintenir cette 
transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité 
ne saurait être engagée pour tout dommage résultant d'un virus transmis.  
This message is intended exclusively for the designated addressee. It may contain confidential material. If 
you are not the correct addressee, please notify the sender immediately and destroy the message. The 
content of this message will engage the responsibility of Steria only if it has been sent by an authorized 
person acting in the strict scope of his functions and for purposes that are related to his competence. 
Although reasonable efforts have been made to keep this transmission free from viruses, the sender will not 
be liable for damages caused by a transmitted virus.  
xml mailing list, project page
xml gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]