Install libevent under Ubuntu today, download the source code
- TAR-XZVF libevent-1.4.15.tar.gz
- CD libevent-1.4.15
- ./configure
- Make
- Make install #可能需要sudo
Automatically installed under the/usr/local/lib directory, if the following link is wrong, or if the compiler successfully ran the executable prompt can ' t open share object something, please add in ~/.profile
Export ld_library_path=/usr/local/lib: $LD _library_pathexport libdir=/usr/local/lib: $LIBDIR #export LD_LIBRARY_PATH =export ld_run_path=:/usr/local/lib: $LD _RUN_PATH#GCC Find the path to the header file #export c_include_path=/usr/include/libxml2:/mylib#g + + Find the path to the header file export cplus_include_path= $CPLUS _include_path:~/workspace/boost_1_60_0# Find the path to the dynamic link library export Ld_library_ Path=/usr/local/lib: $LD _library_path# Find the path to the static library export library_path=/usr/local/lib: $LIBRARY _path
I look at the changes, compile files, such as I want to compile libevent under the test/directory time-test.c file
Bash input (gcc Connect command-l to last):
GCC time-test.c-levent
Note that the compilation command I used earlier is
Causes the compilation does not pass, prompts many Libevent API function undefined, looked for half a day reason only then discovers, slightly pits ~
Linux installation Libevent