2017-01-19 32 views
3

我不得不設置的圖形文件所需的圖形代碼的執行在代碼塊從以下網站: -graphics.h中的代碼塊不工作與MinGW的在64位Windows 7

http://www.codewithc.com/how-to-include-graphics-h-in-codeblocks

然後我試過這個示例代碼。

#include <graphics.h> 
int main() 
{ 
    initwindow(400, 300, "First Sample"); 
    circle(100, 50, 40); 
    while (!kbhit()) 
    { 
     delay(200); 
    } 
    return 0; 
} 

但是當我運行的代碼塊中的代碼,我得到這個

draw.exe has stopped working...

output of the program

任何人都可以解決我的問題?

+0

https://stackoverflow.com/questions/20313534/how-to-use-graphics-h-in-codeblocks/46300800 –

回答

6

這是因爲graphics.h是從1989年開始用於16位MS DOS計算機的Borland's BGI圖形庫。但是您使用的是64位Windows計算機。

解決方法:不要使用28歲的非標準圖書館。

+1

怎麼還有教程建議使用這個!? –

+0

@Colin__s:因爲互聯網永遠不會忘記? – alk

+2

@alk這並不能解釋爲什麼,因爲這個圖書館甚至在互聯網成爲主流之前就已經過時了:) – Lundin