尝试从 zeromq 教程编译示例 hello_world.c:http://zguide.zeromq.org/page:all#Ask-and-Ye-Shall-Receive 很 确定我已经在 OSX Mountain Lion 中安装了所有东西。
clang -Wall hwserver.c -o hwserver
给我一个错误:
Undefined symbols for architecture x86_64:
"_zmq_bind", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_ctx_new", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_close", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_data", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_init", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_init_size", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_recv", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_msg_send", referenced from:
_main in hwserver-OgrEe6.o
"_zmq_socket", referenced from:
_main in hwserver-OgrEe6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我不是最有经验的 C。不确定我是否确定要为 zmq dylib 或标头添加编译器标志,或者我的 $PATH 是否关闭。
在 /usr/local/lib 中:
libzmq.3.dylib
libzmq.a
libzmq.dylib
libzmq.la
在 /usr/local/include 中:
zmq.h
zmq_utils.h
并回显 $PATH:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/lib/:/usr/local/include/