运行 cygwin 上的后记文件

Running a postscript file on cygwin

我已经编写了一个小的 c++ 代码来生成一个 postscript 文件。我已经安装了 ghostscript 查看器。我正在尝试在 cygwin 中打开 .ps 文件,但出现以下错误。

$ gs.exe fill_rect_chd.ps
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GPL Ghostscript 9.15: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
GPL Ghostscript 9.15: Cannot open X display `(null)'.
Unrecoverable error: ioerror in setpagedevice
Operand stack:
    true  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--

我是后记的新手。这是 .ps 文件中的代码

$ cat fill_rect_chd.ps
1 0 0 setrgbcolor
0 0 moveto
100 0 lineto
100 100 lineto
0 100 lineto
 fill

任何人都可以 suggest/Help 我解决这个错误。

如评论所述,您需要(安装和)运行 x.org X-server 程序(Cygwin 附带:select X11:xinit 程序包) 以打开图形 window。或者您可以安装 Windows 版本的 ghostscript。

我无法在 Cygwin 上弄清楚,但我在我的 windows 上安装了 GSview,这很容易打开一个“.ps”文件。

谢谢大家的帮助,我会安装服务器 X 并检查。