I am trying to use sqlite3 through C with cgo (I know that go has a sqlite3 wrapper, but want to try this way). This program gives me an error message
(Undefined symbols for architecture x86_64:
"_sqlite3_open", referenced from:
__cgo_1d4838eae1de_Cfunc_sqlite3_open in cGo.cgo2.o
(maybe you meant: __cgo_1d4838eae1de_Cfunc_sqlite3_open)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
, and I do not understand why - could someone help me with understanding how to open a new database stream?
// cGo
package main
/*
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
*/
import "C"
//import "fmt"
func main() {
var t* C.sqlite3
C.sqlite3_open("test.db", t)
}