C++ boost libraries shared_memory_object undefined reference to 'shm_open'

前端 未结 4 1160
囚心锁ツ
囚心锁ツ 2021-01-04 00:21

I tried to compile the following code on ubuntu 11.04:

#include  
#include  

int main() 
         


        
4条回答
  •  北海茫月
    2021-01-04 00:48

    shm_open is made available by linking librt. Try passing -lrt flag to the linker.

    Try: g++ -c -Wall shared.cpp

    g++ -L /lib -lrt shared.o -o shared

提交回复
热议问题