如何在Ubuntu上为sqlite3安装extension-functions.c [英] How to install extension-functions.c for sqlite3 on ubuntu
问题描述
我在Ubuntu上使用sqlite3,并且希望添加由extension-functions.c文件提供的acos和asin函数。
https://github.com/seth/RSQLite.extfuns/blob/master/ src / extension-functions.c
当我按照源代码中给出的说明,我得到以下错误,我没有找到任何答案关于我如何可以得到这个工作。我尝试在Ubuntu 15.04,15.10和现在16.04。
extension-functions.c:在函数'print_elem':
extension-functions.c:1942:10:warning:format'%lld'期望类型为'long long int'的参数,但是参数3的类型为'int64_t {aka long int}'[-Wformat =]
printf(%d =>%lld\\\
,ee,c);
^
这是我做的:
- 我安装了sqlite3,libsqlite3-0,libsqlite3-3:i386和libsqlite3-dev。
- 我下载了 extension-functions.c 加入新文件夹
- 在新文件夹中执行
$ gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
/ li>
=>然后我得到上述错误。
打印 int64_t
的正确方法是:
#include< inttypes.h>
...
printf(%d =>%PRId64\\\
,ee,c);
在程序/库中,您可以更改打印方式以获得所需的结果。 p>
可以找到完整的打印格式列表这里。您可以使用脚本修复打印。
I use sqlite3 on Ubuntu and would like to add the acos and asin functions that are provided by the extension-functions.c file.
https://github.com/seth/RSQLite.extfuns/blob/master/src/extension-functions.c
When I follow the instructions given in the source code, I get the following error and I didn't find any answer on how I could get this working. I tried on Ubuntu 15.04, 15.10 and now 16.04.
extension-functions.c: In function ‘print_elem’:
extension-functions.c:1942:10: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
printf("%d => %lld\n", ee,c);
^
Here's what I did:
- I installed sqlite3, libsqlite3-0, libsqlite3-3:i386, and libsqlite3-dev.
- I downloaded the extension-functions.c into a new folder
- inside the new folder I executed
$ gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
as suggested in the source code.
=> and then I get the error mentioned above.
What am I doing wong?
Correct way to print an int64_t
is:
#include <inttypes.h>
...
printf("%d => %" PRId64 "\n", ee, c);
In your program / library, you can change the way you print to get the desired result.
Complete list of print formats can be found here. You can use a script to fix the printing.
这篇关于如何在Ubuntu上为sqlite3安装extension-functions.c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!