What do I need to do to link with xlib?

后端 未结 5 1915
陌清茗
陌清茗 2021-02-05 05:15

I am using GCC, what switches do I need to add to link with Xlib? After searching, all I could find was -lX11, but that gave me ld: library not found for -lX1

5条回答
  •  广开言路
    2021-02-05 05:47

    You can usually use pkg-config to determine the flags you need to pass:

    gcc my-program.c $(pkg-config --cflags --libs x11) -o my-program
    

提交回复
热议问题