help compiling a program using Xlib

Greg Davey gbdavey@acsu.buffalo.edu
Sat Nov 8 15:04:00 GMT 2003


When compiling for X, you must explicitly link it with libX11.

g++ -lX11 -L<absolute path to X11 libs> <filename-to-compile> -o
<output-filename>

ex.) on my system your code compiles fine using

g++ -lX11 -L/usr/X11R6/lib gcctest.cc

Reality is but a brief respite between my fantasies.
                                                        -unknown



More information about the Gcc-help mailing list