2015-10-05 53 views
-1

我寫了一個小的C++代碼來生成postscript文件。我已經安裝了ghostscript查看器。我想在cygwin中打開.ps文件,但得到了下面的錯誤。在cygwin上運行postscript文件

$ 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-- 

我是新來的postscript。這是出現在.PS代碼文件

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

任何人都可以請建議/幫助我這個錯誤。

+0

這裏[tag:C++]的相關性是什麼?刪除了標籤。詢問時顯示C++代碼。 –

+2

看起來你沒有運行X服務器。 – molbdnilo

回答

0

如上所述,您需要(安裝和)運行x.org X-server程序(Cygwin附帶:選擇X11:xinit程序包)以打開圖形窗口。或者你可以安裝Windows版本的ghostscript。

0

我無法弄清Cygwin,但我在我的Windows上安裝了GSview,並且很容易打開一個「.ps」文件。

謝謝大家的幫助,我將安裝服務器X並檢查。