symisc / unqlite

An Embedded NoSQL, Transactional Database Engine
https://unqlite.symisc.net
Other
2.11k stars 164 forks source link

Header issue: pgno pgno invalid with g++ 4.4.x #24

Closed woldendans closed 9 years ago

woldendans commented 9 years ago

With g++ 4.4.7, on a Linux system, including "unqlite.h" surrounded by "extern C" instruction in a CPP file, I get the following error:

[exec] unqlite.h:661: error: declaration of `pgno unqlite_page::pgno'
[exec] unqlite.h:651: error: changes meaning of `pgno' from `typedef sxu64 pgno'

This is due to:

typedef sxu64 pgno;
/*
 * A database disk page is represented by an instance
 * of the follwoing structure.
 */
typedef struct unqlite_page unqlite_page;
struct unqlite_page
{
  unsigned char *zData;       /* Content of this page */
  void *pUserData;            /* Extra content */
  pgno pgno;                  /* Page number for this page */ // <------ This
};

The unqlite lib was compiled with a C compiler, but I have to use a C++ one with the public header.

This is due to the g++ version I believe. I reported this so you know and can decide whether it is something you'd like to handle or not.

Cheers!

symisc commented 9 years ago

Hi, The patch is already available here http://unqlite.org/db/g++421patch.diff