1

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

ずっと頭を悩ませています。

解決策をありがとう。

サム・アイベリッシュ

4

1 に答える 1

3

ライブラリを参照するソース ファイルの後にライブラリを配置します。

gcc -g -Wall test_redis.c -lcredis -o redisOUT
于 2013-03-09T15:57:58.620 に答える