我是否需要用extern“包装SQlite调用?”;";在我的C++;应用 我需要在C++应用程序中包装Sql()库调用为: extern "C" { //Wrapping SQLite C header #include "sqlite3.h" // Some example function definitions int sqlite3_open(const char *filename,sqlite3 **ppDb); void sqlite3_free(void*); int sqlite3_close(sqlite3*); }

我是否需要用extern“包装SQlite调用?”;";在我的C++;应用 我需要在C++应用程序中包装Sql()库调用为: extern "C" { //Wrapping SQLite C header #include "sqlite3.h" // Some example function definitions int sqlite3_open(const char *filename,sqlite3 **ppDb); void sqlite3_free(void*); int sqlite3_close(sqlite3*); },c++,c,sqlite,C++,C,Sqlite,或者我可以直接访问图书馆(如网站上的大多数示例所示)?我也想知道正确答案背后的原因。sqlite3.h已经包含了一个外部“C”包装器。来源: /* ** Make sure we can call this stuff from C++. */ #ifdef __cplusplus extern "C" { #endif … #ifdef __cplusplus } /* end of the 'extern "C"' block */ #endif 因此,您不需要自己包装它

或者我可以直接访问图书馆(如网站上的大多数示例所示)?我也想知道正确答案背后的原因。

sqlite3.h
已经包含了一个
外部“C”
包装器。来源:

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif

…

#ifdef __cplusplus
}  /* end of the 'extern "C"' block */
#endif
因此,您不需要自己包装它