Hi everyone, what is the best way to install sqlite3 database on jetson nano and use it in visual code with c++? Thanks in advance!
I can’t answer all of that, but if you are on a Jetson, then you can search for packages with that in the name:
apt search sqlite3
You’ll find that and other packages related to it (such as sqlite3-doc
) you can install. Example:
sudo apt-get install sqlite3
Note that the apt
tool understands dependencies, and so it would automatically (if you choose to install) install for example a related library package, libsqlite3
. The libraries and executable are the “runtime” components, but if you are going to compile in C or C++, then you need a dev package, but the dev package links against the library, and not against the sqlite3
executable. A useful search:
apt search libsqlite3
The package a developer would be interested in, despite libsqlite3
already being installed (for runtime), would be sqlite3-dev
. You will find most of the environment for developing an application has a separate “-dev
” package.
If you have limited space on a Jetson you might not want to install the “-doc
” package, but you could install that on an Ubuntu host PC and have man
pages available.
Pretty much anything with a C API can be linked to in C++. Details differ on different operating systems, but the support is quite good in Linux for those bindings. The trick for C libraries under C++ is that any include headers must wrap the include statement in “extern
” (C++ has name mangling to support namespaces, and extern
disables name mangling which is good since a C API call is exactly that call without name mangling). Examples:
extern "C" {
#include <something>
#include <somethingelse>
}
(restated: If extern, then there is no such thing as overloading of a given name)
If you were to do the reverse, and build C++ code which a C program might need to link to, then in C++ you could create this function as part of a library:
extern "C" int something(cont int foo)
{
int bar = foo * 2;
return bar;
}
(within C++ that function could not be overloaded, so a C program linking to it would be happy)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.