[英]Compiling and linking libev on Mac OS X
Yet another symbol(s) not found issue with Mac OS X. I wrote a C program that uses the libev event loop library that when compiled produces this output: Mac OS X没有找到另一个符号问题。我编写了一个使用libev事件循环库的C程序,在编译时产生这个输出:
$ make
clang midnight.c midnight_logging.c -o midnight
Undefined symbols for architecture x86_64:
"_ev_default_loop", referenced from:
_main in midnight-Wlcawk.o
"_ev_io_start", referenced from:
_main in midnight-Wlcawk.o
"_ev_run", referenced from:
_main in midnight-Wlcawk.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [midnight] Error 1
I used homebrew to install libev. 我用自制软件来安装libev。 The shared library is in /usr/local/lib per normal and I've used every combination of compiler arguments including "-I /usr/local/lib", "-l libev" and "-L /usr/local/lib".
共享库每个正常位于/ usr / local / lib中,我使用了编译器参数的每个组合,包括“-I / usr / local / lib”,“ - l libev”和“-L / usr / local / lib” ”。
Assistance appreciated, I'd rather not have to statically compile. 援助表示赞赏,我宁愿不必静态编译。
But you do not link against libev! 但是你没有与libev联系! The compiler isn't a clairvoyant (nor is the linker), you have to tell it what to search for those symbols...
编译器不是透视者(也不是链接器),你必须告诉它搜索那些符号的内容......
clang midnight.c midnight_logging.c -o midnight -lev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.