[Xcb] want to compile an example code.

Alan Coopersmith alan.coopersmith at oracle.com
Sun Oct 4 20:52:58 UTC 2020

On 10/4/20 12:38 PM, Hans Schüren wrote:
> Hello,
> i want to compile a sample code from the XCB manual.
> There are the following errors. What can i do ?
> I use FreeBSD and have XCB installed.
> barchart.c   Motif/       xcbsample.c
> nomad at NomadBSD ~/programmieren> gcc -Wall xcbsample.c -o xcbsample  pkg-config 
> --cflags --libs xcb
> fish: Unknown command: gcc
> nomad at NomadBSD ~/programmieren [127]> cc -Wall xcbsample.c -o xcbsample  
> pkg-config --cflags --libs xcb
> cc: error: unsupported option '--cflags'
> cc: error: unsupported option '--libs'
> cc: error: no such file or directory: 'pkg-config'
> cc: error: no such file or directory: 'xcb'

You need to put $( ) or ` ` around the pkg-config command so that the
output of the pkg-config command is used as flags to the compiler:

cc -Wall xcbsample.c -o xcbsample $(pkg-config --cflags --libs xcb)


cc -Wall xcbsample.c -o xcbsample `pkg-config --cflags --libs xcb`

(It depends on what shell you use - the first is preferred for most shells,
  but some old shells like csh may require the second form.)

	-Alan Coopersmith-               alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc

More information about the Xcb mailing list