- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近开始学习 ZEROMQ,但我陷入了困境。我尝试运行天气更新示例(wuclient.c 和 wuserver.c),但出现以下错误。
In file included from wuclient.c:5:0:
zhelpers.h: In function ‘s_sleep’:
zhelpers.h:133:5: warning: implicit declaration of function ‘nanosleep’ [-Wimplicit-function-declaration]
zhelpers.h: In function ‘s_console’:
zhelpers.h:158:5: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
zhelpers.h:159:12: warning: implicit declaration of function ‘localtime’ [-Wimplicit-function-declaration]
zhelpers.h:159:26: warning: initialization makes pointer from integer without a cast [enabled by default]
zhelpers.h:161:5: warning: implicit declaration of function ‘strftime’ [-Wimplicit-function-declaration]
zhelpers.h:161:5: warning: incompatible implicit declaration of built-in function ‘strftime’ [enabled by default]
wuclient.c: At top level:
zhelpers.h:60:1: warning: ‘s_send’ defined but not used [-Wunused-function]
zhelpers.h:67:1: warning: ‘s_sendmore’ defined but not used [-Wunused-function]
zhelpers.h:75:1: warning: ‘s_dump’ defined but not used [-Wunused-function]
zhelpers.h:115:1: warning: ‘s_set_id’ defined but not used [-Wunused-function]
zhelpers.h:125:1: warning: ‘s_sleep’ defined but not used [-Wunused-function]
zhelpers.h:139:1: warning: ‘s_clock’ defined but not used [-Wunused-function]
zhelpers.h:156:1: warning: ‘s_console’ defined but not used [-Wunused-function]
我用来编译它的命令是:gcc -Wall wuclient.c -o wuclient -L/usr/local/lib -lzmq
这是 zhelpers.h 代码 https://github.com/imatix/zguide/blob/master/examples/C/zhelpers.h这是导致错误的原因。
它包含在下面的代码中:
// Weather update client
// Connects SUB socket to tcp://localhost:5556
// Collects weather updates and finds avg temp in zipcode
#include "zhelpers.h"
int main (int argc, char *argv [])
{
// Socket to talk to server
printf ("Collecting updates from weather server...\n");
void *context = zmq_ctx_new ();
void *subscriber = zmq_socket (context, ZMQ_SUB);
int rc = zmq_connect (subscriber, "tcp://localhost:5556");
assert (rc == 0);
// Subscribe to zipcode, default is NYC, 10001
char *filter = (argc > 1)? argv [1]: "10001 ";
rc = zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE,
filter, strlen (filter));
assert (rc == 0);
// Process 100 updates
int update_nbr;
long total_temp = 0;
for (update_nbr = 0; update_nbr < 100; update_nbr++) {
char *string = s_recv (subscriber);
int zipcode, temperature, relhumidity;
sscanf (string, "%d %d %d",
&zipcode, &temperature, &relhumidity);
total_temp += temperature;
free (string);
}
printf ("Average temperature for zipcode '%s' was %dF\n",
filter, (int) (total_temp / update_nbr));
zmq_close (subscriber);
zmq_ctx_destroy (context);
return 0;
}
我打开了“zhelpers.h”文件,其中包含“time.h”。所以我很困惑为什么会发生这种情况。我正在使用 Ubuntu 12.04,拜托,我既不是 C 也不是 ZEROMQ 专家,但这个软件看起来像是我跨越论文障碍的现实希望。
谢谢。
最佳答案
请注意,这些只是警告而不是错误。编译器仍会生成一些内容,但可能无法按预期工作。
头文件“zhelpers.h”在 Ubuntu 上包含
后半部分警告与“zhelpers.h”中有函数定义有关。这是非常糟糕的编码风格,但程序应该仍然可以工作。
关于c - ZEROMQ 编译器错误中的 zhelpers.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24469077/
我最近开始学习 ZEROMQ,但我陷入了困境。我尝试运行天气更新示例(wuclient.c 和 wuserver.c),但出现以下错误。 In file included from wuclient.
我正在尝试运行下面给出的程序(我从 zeromq 教程中复制的)。我收到错误 Python 导入错误:没有名为 zhelpers 的模块 我试过安装 sudo apt-get install zhel
我是一名优秀的程序员,十分优秀!