對 shm open 未定義的引用

2021-09-19 13:42:43 字數 396 閱讀 8529

編譯出錯:

對『shm_open』未定義的引用

原因:一般出錯的原因是沒有鏈結庫導致的

解決方法:

在編譯最後新增 -lrt

例如:gcc -o test test.c -lrt

man shm_open的幫助檔案的最後幾行:

notes

these functions are provided in glibc 2.2 and  later.   programs  using

these  functions  must  specify  the-lrtflag to cc in order to link

against the required ("realtime") library.

對pthread create未定義的引用

已經在c檔案中包含了執行緒的標頭檔案,可是編譯的時候卻報錯 對pthread create未定義的引用 原來時因為 pthread庫不是linux系統預設的庫,連線時需要使用庫libpthread.a,所以在使用pthread create建立執行緒時,在編譯中要加 lpthread引數 gcc c...

對 pthread create 未定義的引用

注 本文由博主同步發布於 對 pthread create 未定義的引用 使用clion,在linux下編寫c 多執行緒程式 使用future和async cmake構建專案失敗,錯誤提示為 對 pthread create 未定義的引用 include include void th1 在函式 s...

對YAML LoadFile的未定義引用

起語 yaml是一種結構化的文件結構,類似於json,xml。相比於json,xml.yaml更適合做配置使用 yaml cpp是常用的yaml庫 yaml cpp 環境安裝 git clone 2.編譯安裝 mkdir build cd build cmake dbuild shared libs...