gpt4 book ai didi

在 Linux 上使用 Redis 编译 C 代码

转载 作者:IT王子 更新时间:2023-10-29 06:10:17 26 4
gpt4 key购买 nike

当我使用 credis API 编译用 C 编写的测试代码时,如何更正以下错误:

 gcc -g -Wall -lcredis test_redis.c -o redisOUT

/tmp/ccetckOb.o: In function `main':
/home/faris/Downloads/credis-0.2.3/test_redis.c:12: undefined reference to `credis_connect'
/home/faris/Downloads/credis-0.2.3/test_redis.c:15: undefined reference to `credis_ping'
/home/faris/Downloads/credis-0.2.3/test_redis.c:18: undefined reference to `credis_set'
/home/faris/Downloads/credis-0.2.3/test_redis.c:21: undefined reference to `credis_get'
/home/faris/Downloads/credis-0.2.3/test_redis.c:25: undefined reference to `credis_close'

collect2: error: ld returned 1 exit status

示例:http://code.google.com/p/credis/wiki/Examples

我脑子坏了这么久。

感谢解决。

山姆·艾弗里什

最佳答案

将库放在引用它的源文件之后:

gcc -g -Wall test_redis.c -lcredis -o redisOUT

关于在 Linux 上使用 Redis 编译 C 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15312679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com