c - MonetDB 客户端编译
问题描述
我是数据库社区的初学者。我一直在尝试使用 C/C++ MAPI与 MonetDB 交互。我已经在我的 Ubuntu 14.04 LTS 机器上安装了 MonetDB,当我尝试从这里编译示例程序时,我收到以下错误:
$ gcc test.c -I /usr/include/monetdb -lmapi
test.c:(.text+0x29): undefined reference to
mapi_explain_query' test.c:(.text+0x35): undefined reference to
mapi_result_error' test.c:(.text+0x50): undefined reference tomapi_explain_result' test.c:(.text+0x5c): undefined reference to
mapi_next_result' test.c:(.text+0x6d): undefined reference tomapi_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
更新': 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”collect2 的未定义引用:错误:ld 返回 1 个退出状态
这个问题以前在这里被问过,答案并没有解决问题(虽然答案被接受了,我不知道为什么)。任何帮助/方向都会很棒!
解决方案
在 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
推荐阅读
- php - 是否可以使用 Live-server for PHP 并在保存时自动重新加载?
- java - 即使没有错误,JavaFX 函数也不起作用
- node.js - 如何使用expressjs,postgresql处理护照中忘记的密码
- css - CSS不透明度不适用于chrome但适用于firefox
- c# - 无法在 Windows 7 的 Visual Studio 中使用 Android 模拟器
- flutter - “无法获取 cmap 表大小!” 即使没有使用外部字体,也会发生颤动
- python - XARRAY 等高线图 AttributeError: Contourf
- swift - Apple 是否有办法将一个视图的外观(即您在屏幕上实际看到的内容)复制到图像缓冲区中?
- c# - 使用 SharpSerializer 反序列化 Arraylist 的 Arraylist
- applescript - applescript中的文本格式问题