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

前端 未结 4 1194
囚心锁ツ
囚心锁ツ 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:58

    Just adding to @anio's answer:

    While linking, the -lrt flag may need to be added at the end of the command. Try:

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

提交回复
热议问题