Re: [xml] Docbook compilation error

On Thu, Nov 20, 2003 at 10:03:12AM +1100, Malcolm Tredinnick wrote:
There is this source file "ext.c" in docbook2x that includes "hash.h", which in turn includes the 
"parser.h" header file.

At attempting to compile, I get the following error:

In file included from hash.h:22,
                 from ext.c:19:
parser.h:265: parse error before "xmlHashTablePtr"

You can define pointers to structures even though the structure
definition is not available. A pointer is the same size, no matter what
it points to. This is a typical way to define an opaque pointer.


The error you are seeing does not necessarily come from the libxml2 code

   It may come from some changes in the libxml2 code where 
both parser.h and hash.h depends on each other... 
   hash.h requires xmlChar so it includes parser.h, but parser.h
requires hash.h for the hash tables in the parser context.
the solution is both simple and ugly: export the structure first then
call other includes ...

#ifndef __XML_HASH_H__
#define __XML_HASH_H__
#ifdef __cplusplus
extern "C" {
 * The hash table.
typedef struct _xmlHashTable xmlHashTable;
typedef xmlHashTable *xmlHashTablePtr;
#ifdef __cplusplus
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef __cplusplus
extern "C" {

   I will commit this in CVS. For the applications the simplest is to 
#include <libxml/parser.h> before #include <libxml/hash.h>


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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