undefined reference to `shmctl'
-
25-10-2019 - |
Question
i'm trying to compile my programm(it's a server that uses shared memory) and when i try to delete the shared memory(shmctl()
) inside a signal handler for SIGINT i keep getting
undefined reference to `schmctl'
i searched around and saw that this usually requires something like
gcc -o server server.c -lrt
to compile,but even then i keep getting the same error. Can anyone help me understand what i should do,and what -lrt or whatever is needed means?
Solution
-lrt
means you are linking with librt.a
library. To get rid of your error you should find the library where symbol shmctl is defined and then pass it to gcc
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow