Tag: rabbitmq

针对rabbitmq-c构建

我试图在c中连接到rabbitmq并且每次都失败了。 我是这样做的。 下载了rabbitmq-c 安装它( make && make install )只是为了确保满足依赖性。 修改了amqp_sendstring.c连接变量 使用make重建,运行./amqp_sendstring并且它有效 然后我开始创建自己的文件并使用gcc通过gcc编译它们: gcc -lrabbitmq -o j_test test.c 具有讽刺意味的是,它无法与librabbitmq链接以下错误: /tmp/cc63IlXq.o: In function `main’: test.c:(.text+0xa): undefined reference to `amqp_new_connection’ test.c:(.text+0x1a): undefined reference to `amqp_destroy_connection’ collect2: ld returned 1 exit status 我从ampq_ *开始删除了所有内容。 瞧! 它成功建成。 这对我来说是gcc能够找到头而不是lib的指示器。 这是test.c源代码: #include #include int main(int argc, char const * const *argv) { […]