开发者

Reason and solution for error -"/usr/bin/ld: cannot find -levent "?

开发者 https://www.devze.com 2022-12-11 09:30 出处:网络
While compiling my program which is using libevent library I am using gcc option -levent. But I am getting this error -

While compiling my program which is using libevent library I am using gcc option -levent. But I am getting this error -

/usr/bin/ld: cannot find -levent

I do not have libevent on my system so I am statically linking 开发者_StackOverflowto it while compiling using

gcc -o Hello -static -I libevent-1.4.12-stable/ hello.c -levent

How can i resolve this?

Thanks in advance!


Where is the libevent.(a|so) file on your system?

If it isn't on your system's library path then you will have to add a -L option adding its location to the list of paths searched by the linker for libraries.

e.g.

gcc -L/folder/containing/event/lib -levent mysource.cc


You need to have the libevent on your system or need to specify its path explicitly (if its a third-party library you got with the headers).

I suspect its not in your default /lib paths.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号