作者driftheart ()
看板LEFTBANK
標題Re: [問題] 手廿念
時間Wed May 2 03:01:44 2007
前文吃光光
我在網路上找到這個hello word 的 code
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
int main(argc, argv)
int argc;
char **argv;
{
Tk_Window mainWindow;
Tcl_Interp *tcl_interp;
tcl_interp = Tcl_CreateInterp();
if(Tcl_Init(tcl_interp) != TCL_OK || Tk_Init(tcl_interp) != TCL_OK) {
if(*tcl_interp->result)
(void)fprintf(stderr,"%s: %s\n", argv[0], tcl_interp->result);
exit(1);
}
mainWindow = Tk_MainWindow(tcl_interp);
if (mainWindow == NULL) {
fprintf(stderr, "%s\n", tcl_interp->result);
exit(1);
}
存成 hello.c 之後
gcc hello.c -I/usr/include -L/usr/lib -ltcl -ltk
^^^^^^^^^^^^^^^ ^^^^^^^^^
tcl/tk *.h 的位置 *.a 的位置OB
就會產生 a.out 了
要執行的話要先在 cygwin 的 terminal 裡下 startx 把 x-window 打開
然後在它的 xterm 裡執行才行喔
如果你不是要透過 c 去呼叫
我得再研究一下
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.174.112
推 litodora:看不懂...啥鬼東西 05/03 00:51
→ mamato:我都不好意思說看不懂了...真羞~XD 05/03 21:28
→ mamato:話說這幾天有位新同學,聽說之前寫了一年的程式..真猛@@ 05/03 21:29
推 litodora:阿肥在寫程式喔?? 05/04 02:43
推 mamato:哈哈 是我們公司的新同學~阿肥寫程式??見鬼了~~~~~~~~~~~~~ 05/05 00:35
推 okite:是喔!!哪一個? 05/05 00:46
推 litodora:好歹我也寫過程式阿~~~ 05/05 01:48