MonetDB client compilation

∥☆過路亽.° 提交于 2019-12-11 17:47:13

问题


I'm a beginner in the Database community. I have been trying to interface with MonetDB using C/C++ MAPI. I have installed MonetDB on my Ubuntu 14.04 LTS machine and when I try to compile a sample program from here, I get the following error:

$ gcc test.c -I /usr/include/monetdb -lmapi

test.c:(.text+0x29): undefined reference to mapi_explain_query' test.c:(.text+0x35): undefined reference tomapi_result_error' test.c:(.text+0x50): undefined reference to mapi_explain_result' test.c:(.text+0x5c): undefined reference tomapi_next_result' test.c:(.text+0x6d): undefined reference to mapi_close_handle' test.c:(.text+0x79): undefined reference tomapi_destroy' test.c:(.text+0x98): undefined reference to mapi_explain' test.c:(.text+0xa4): undefined reference tomapi_destroy' /tmp/cctyQopc.o: In function query': test.c:(.text+0xf9): undefined reference tomapi_query' test.c:(.text+0x110): undefined reference to mapi_error' /tmp/cctyQopc.o: In functionupdate': test.c:(.text+0x160): undefined reference to mapi_close_handle' /tmp/cctyQopc.o: In functionmain': test.c:(.text+0x1b6): undefined reference to mapi_connect' test.c:(.text+0x1c6): undefined reference tomapi_error' test.c:(.text+0x238): undefined reference to mapi_fetch_field' test.c:(.text+0x24d): undefined reference tomapi_fetch_field' test.c:(.text+0x277): undefined reference to mapi_fetch_row' test.c:(.text+0x287): undefined reference tomapi_close_handle' test.c:(.text+0x293): undefined reference to `mapi_destroy' collect2: error: ld returned 1 exit status

This question has previously been asked here and the answer did not solve the problem (although the answer was accepted, I'm not sure why). Any help/directions would be great!


回答1:


On Ubuntu 18.04 using:

pkg-config --libs monetdb-mapi and pkg-config --cflags monetdb-mapi

Won't work because Ubuntu doesn't have a bzip2.pc:

Here how it worked:

gcc main.c -I /usr/include/monetdb -lmapi -lssl -lcrypto -lstream -lcurl -llzma -lbz2



来源:https://stackoverflow.com/questions/51644081/monetdb-client-compilation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!