GLFW3 - Undefined reference to XRR

主宰稳场 提交于 2019-12-01 16:38:12

I figured out the answer myself while writing the question.

I was misled into believing that I was linking everything necessary because of the output of

pkg-config --libs --cflags --print-requires glfw3 

which was

-I/usr/local/include  -L/usr/local/lib -lglfw3  

The --print-requires flag was having no impact at all on the output, which seemed odd. I searched and printed the corresponding .pc file.

sudo find / | grep "glfw3\.pc"
cat /usr/local/lib/pkgconfig/glfw3.pc 

There I found this.

Requires.private:  x11 xrandr xi xxf86vm gl

Which indicates which libraries are required for static linking. I added their correponding flags to CMake and it worked. My mistake was that I missed the --print-requires-private flag when executing pkg-config.

I hope this helps someone save some time.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!