Search code examples
csqlitecygwin

Sqlite3 with cygwin


How to install Sqlite3 with Cygwin? When I try to compile in Cygwin like this:

gcc -o basics basics.c

it says:

/tmp/ccpS4NGr.o:basics.c:(.text+0x67): undefined reference to _sqlite3_open' /tmp/ccpS4NGr.o:basics.c:(.text+0x10b): undefined reference to_sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x172): undefined reference to _sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x1d9): undefined reference to_sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x243): undefined reference to _sqlite3_prepare _v2' /tmp/ccpS4NGr.o:basics.c:(.text+0x279): undefined reference to_sqlite3_column_ count' /tmp/ccpS4NGr.o:basics.c:(.text+0x28f): undefined reference to _sqlite3_step' /tmp/ccpS4NGr.o:basics.c:(.text+0x2cb): undefined reference to_sqlite3_column_ text' /tmp/ccpS4NGr.o:basics.c:(.text+0x2ec): undefined reference to _sqlite3_column_ name' /tmp/ccpS4NGr.o:basics.c:(.text+0x355): undefined reference to_sqlite3_close' collect2: ld returned 1 exit status

I kept the sqlite3.h in the same directory of basics.c along with 3 other files that comes with sqlite-amalgamation package


Solution

  • How are you including it?

    #include <sqlite.h>
    

    or

    #include "sqlite.h"
    

    The latter form might well work; it'll check the current folder before the include path.