我是数据库社区的初学者。我一直在尝试使用C / C ++ MAPI与MonetDB进行交互。我在我的Ubuntu 14.04 LTS机器上安装了MonetDB,当我尝试从here编译示例程序时,我收到以下错误:
$ gcc test.c -I /usr/include/monetdb -lmapi
test.c :(。text + 0x29):未定义引用
mapi_explain_query' test.c:(.text+0x35): undefined reference to
mapi_result_error'test.c :(。text + 0x50):未定义引用mapi_explain_result' test.c:(.text+0x5c): undefined reference to
mapi_next_result'test.c :(。text + 0x6d):未定义引用mapi_close_handle' test.c:(.text+0x79): undefined reference to
mapi_destroy'test。 c :(。text + 0x98):对mapi_explain' test.c:(.text+0xa4): undefined reference to
mapi_destroy'/tmp/cctyQopc.o的未定义引用:在函数query': test.c:(.text+0xf9): undefined reference to
mapi_query'test.c :(。text + 0x110)中:未定义引用mapi_error' /tmp/cctyQopc.o: In function
update':test.c :(。text + 0x160):未定义引用mapi_close_handle' /tmp/cctyQopc.o: In function
main':test.c :(。text + 0x1b6):未定义引用mapi_connect' test.c:(.text+0x1c6): undefined reference to
mapi_error'test.c :(。text + 0x238):未定义引用mapi_fetch_field' test.c:(.text+0x24d): undefined reference to
mapi_fetch_field'test.c :(。text + 0x277 ):未定义引用mapi_fetch_row' test.c:(.text+0x287): undefined reference to
mapi_close_handle'test.c :(。text + 0x293):未定义引用`mapi_destroy'colle2:错误:ld返回1退出状态
此问题之前曾被问过here并且答案没有解决问题(尽管答案被接受了,但我不确定为什么)。任何帮助/方向都会很棒!
在Ubuntu 18.04上使用:
pkg-config --libs monetdb-mapi和pkg-config --cflags monetdb-mapi
因为Ubuntu没有bzip2.pc而无法工作:
它是如何工作的:
gcc main.c -I / usr / include / monetdb -lmapi -lssl -lcrypto -lstream -lcurl -llzma -lbz2