This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Sample code for beginners of tcl/tk & cygwin32 environment
- To: gnu-win32 at cygnus dot com
- Subject: Sample code for beginners of tcl/tk & cygwin32 environment
- From: "Y. Ahmet Sekercioglu" <yas at oberon dot csse dot swin dot edu dot au>
- Date: Thu, 20 Nov 1997 22:55:23 +1100 (EST)
Dear All,
With the aid of some helpful people, I have managed to
compile and run my first tcl/tk - cygwin32 program.
I am copying the ``Hello World'' program here hoping to save
the beginners a few hours of work:
=================================
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
/* tkhelloworld.c: downloaded somewhere from the Internet and modified */
/* to the tk4.2 */
/* Very first program to start exploring tcl/tk - cygwin32 environment */
/*
compilation & linking on Linux:
gcc -o tkhelloworld tkhelloworld.c -L/usr/X11R6/lib -ltcl -ltk -lX11 -ldl -lm
compilation & linking on WinNT (cygwin32 version b18):
gcc -o tkhelloworld tkhelloworld.c -ltcl7.6 -ltk4.2
*/
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);
}
Tcl_Eval(tcl_interp, "button .b -text \"Hello World\" -command exit");
Tcl_Eval(tcl_interp, "pack .b");
Tk_MainLoop();
exit(1);
}
===Y. Ahmet Sekercioglu (ASekerci@swin.edu.au)=====IP phone:============
School of Information Technology yas.csse.swin.edu.au
Swinburne University of Technology tel: +61-3-92148942
===PO Box 218, Hawthorn, 3122 Vic. Australia=======fax: +61-3-98190823==
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".