Programming in XPCE/Prolog

# F Commonly encountered problems

In this chapter we list a number of commonly encountered problems in using PCE/Prolog.

- Cannot open display
  PCE tries to open the display from the address specified by the DISPLAY environment variable. It ignores the `--display' command line option. The display might also be specified explicitly using `display`<->`address'. PCE will open the display as soon as it needs X-resource values or it needs graphical operations. This will fail if the specified address is not legal, there is no X-server at that address or the X-server denies the access. Examine the error message carefully. Make sure X-windows is running at the specified address. Make sure you have access to this server. See xauth (when running MIT_MAGIC_COOKIE) and xhost. If PCE still complains, validate the access rights by starting a normal X-application (e.g. xterm) in the same context. Always restart PCE after a fatal or system error as the system might be corrupted. This problem is not possible in the Win32 implementation.
- Bad integer reference
  This is a PCE/Prolog interface warning. It implies the integer object reference given to send/[2-12], etc. is not valid. The most common reason is that the object has already be freed, either explicitly or by PCE's incremental garbage collector. See section E.
- Unknown class
  Attempt to create an instance of a non-existing class. Apart from the common mistakes like mistyped class-names, etc. this might be caused by 1) giving a list argument to a send- or get- operation (class `.') or 2) trying to pass a term through send/[2-12] or get/[3-13]. See section 6.1.
- Illegal PCE object description
  This implies a non-translatable Prolog datum was passed to the interface. Normally this will be a non-ground20A `ground' term is a Prolog term that has no unbound variables. argument to new/2, send/[2-12] or get/[3-13].