共有ライブラリのロード中にエラーが発生しました:libwebsockets.so.17:共有オブジェクトファイルを開くことができません

libwebsocketsの例は、次のコンパイル方法を提供します

cmake . && make

自分で書いたコードのコンパイル方法は以下の通りです。

gcc -o server main.c -lwebsockets

結果はエラーです:

./server : error while loading shared libraries: libwebsockets.so.17: cannot open shared object file: No such file or directory

解決:

If you've installed libwebsockets with make install then you probably just need to run sudo ldconfig to update the linker cache.

次のコマンドを実行します

sudo ldconfig

エラー:「longunsignedint」から「longint」に変換すると、結果の符号が変わる可能性があります

CMakeLists.txtの736行目より下のコンテンツをコメントアウトします

#	if ("${DISABLE_WERROR}" STREQUAL "OFF")
#		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
#	endif()

おすすめ

転載: blog.csdn.net/qq_44519484/article/details/112823910