我想通过C与cgo使用sqlite3(我知道去有一个sqlite3包装,但想要尝试这种方式)。这个节目给我一个错误消息如何使用sqlite3.h和cgo打开新的sqlite3数据库?
(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)
,我不明白为什么 - 可能有人帮助我了解如何打开一个新的数据库流?
// 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)
}