The cause and solution of the error is "/ usr / bin / ld: cannot find -levent"?

When compiling my program using the libevent library, I use the gcc option -levent. But I get this error -

/ usr / bin / ld: cannot find -levent

I don't have libevent on my system, so I statically bind to it at compile time with

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

How can i solve this?

Thanks in advance!

+3
source share
2 answers

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

If this is not the path to your system library, you need to add a parameter -Lby adding its location to the list of paths that the linker for libraries was looking for.

eg.

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

libevent ( , ).

, /lib.

0

Source: https://habr.com/ru/post/1722673/


All Articles