Search code examples
linuxeclipsegccunqlite

unqlite.h:651:15: error: changes meaning of ‘pgno’ from ‘typedef sxu64 pgno’ [-fpermissive]


Just downloaded the unqlite.c and unqlite.h, created a new project in Eclipse, copied one of the examples from unqlite.org website and I'm getting the following error:

21:37:51 **** Build of configuration Debug for project nosql ****
make all 
Building file: ../main.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
In file included from ../main.cpp:49:0:
../unqlite.h:661:8: error: declaration of ‘pgno unqlite_page::pgno’ [-fpermissive]
pgno pgno; /* Page number for this page */
^
../unqlite.h:651:15: error: changes meaning of ‘pgno’ from ‘typedef sxu64 pgno’ [-fpermissive]
typedef sxu64 pgno;
^
subdir.mk:25: recipe for target 'main.o' failed
make: *** [main.o] Error 1
21:37:51 Build Finished (took 171ms)

It was meant to be as simple, but I have no clue of what is going on... Has anyone tried this unqLite KV store?

I'm using

gcc version 4.9.2 (Debian 4.9.2-10)

Cheers

ttkdroid


Solution

  • This issue appears when including unqlite.h in a C++ file, and compiling it with a g++. You have two solutions to fix it:

    pgno pgno; /* Page number for this page */

    by

    ::pgno pgno; /* Page number for this page */

    Which will work with a g++ compiler as well as other C++ compilers. Of course, you cannot compile unqlite.c with this edited header, with a C compiler.

    If you want to learn more about this error, this might be a good link: typedef changes meaning

    Have a good day!