undefined reference to symbol 'clock_getres@@GLIBC_2.4

编译时遇到的错误

undefined reference to symbol ‘clock_getres@@GLIBC_2.4
error adding symbols: DSO missing from command line

问题很简单,但是国内网站居然找不到答案,有相关资料也说不清楚,Google了答案转过来,希望方便以后的人

问题就是glib的某个函数没找到,我这里是clock_getres,也可能是其他的函数

解决方法:
就是在makefile中LDFLAGS= 后面加上-lrt

如果没用makefile的话就gcc -o test test.c -lrt

参考文章:http://stackoverflow.com/questions/25637276/official-v4l2-driver-for-raspberry-pi-how-do-i-add-lrt-flags-to-a-makefile

你可能感兴趣的:(undefined reference to symbol 'clock_getres@@GLIBC_2.4)