Hi All
I have found a sample application to call Tk routines from C. However during the compilation, I am getting the following error. I am having a doubt, whether I am including the correct library.
It might be a silly error , please help in solving this error.
Thanking you in advance
Regards
Aman
/***********************C CODE******************************************************/
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
int main(argc, argv)
int argc;
char **argv;
{
Tk_Window mainWindow;
Tcl_Interp *interp;
static char *display = NULL;
interp = Tcl_CreateInterp();
mainWindow = Tk_CreateMainWindow(interp, display, argv[0], "Tk"
;
if (mainWindow == NULL) {
fprintf(stderr, "%s\n", interp->result);
exit(1);
}
if (Tcl_Init(interp) == TCL_ERROR) {
fprintf(stderr, "Tcl_Init failed: %s\n", interp->result);
}
if (Tk_Init(interp) == TCL_ERROR) {
fprintf(stderr, "Tk_Init failed: %s\n", interp->result);
}
Tcl_Eval(interp, "button .hello -text \"Hello World\" -command \"destroy .\""
;
Tcl_Eval(interp, "pack .hello"
;
Tk_MainLoop();
Tcl_Eval(interp, "exit"
;
exit(1);
}
/****************************************************************************************/
/*********** THE ERROR IS *********************************************************/
bash-2.03# gcc -I /usr/local/tcl84/include/ -o tksam tksam.c -L/usr/local/tcl84/lib/libtcl8.4.a -L/usr/local/tcl84/lib/libtk8.4.a
tksam.c: In function `main':
tksam.c:15: warning: assignment makes pointer from integer without a cast
Undefined first referenced
symbol in file
Tcl_Eval /var/tmp/ccRCTzPY.o
Tk_CreateMainWindow /var/tmp/ccRCTzPY.o
Tcl_Init /var/tmp/ccRCTzPY.o
Tk_Init /var/tmp/ccRCTzPY.o
Tk_MainLoop /var/tmp/ccRCTzPY.o
Tcl_CreateInterp /var/tmp/ccRCTzPY.o
ld: fatal: Symbol referencing errors. No output written to tksam
collect2: ld returned 1 exit status
I have found a sample application to call Tk routines from C. However during the compilation, I am getting the following error. I am having a doubt, whether I am including the correct library.
It might be a silly error , please help in solving this error.
Thanking you in advance
Regards
Aman
/***********************C CODE******************************************************/
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
int main(argc, argv)
int argc;
char **argv;
{
Tk_Window mainWindow;
Tcl_Interp *interp;
static char *display = NULL;
interp = Tcl_CreateInterp();
mainWindow = Tk_CreateMainWindow(interp, display, argv[0], "Tk"
if (mainWindow == NULL) {
fprintf(stderr, "%s\n", interp->result);
exit(1);
}
if (Tcl_Init(interp) == TCL_ERROR) {
fprintf(stderr, "Tcl_Init failed: %s\n", interp->result);
}
if (Tk_Init(interp) == TCL_ERROR) {
fprintf(stderr, "Tk_Init failed: %s\n", interp->result);
}
Tcl_Eval(interp, "button .hello -text \"Hello World\" -command \"destroy .\""
Tcl_Eval(interp, "pack .hello"
Tk_MainLoop();
Tcl_Eval(interp, "exit"
exit(1);
}
/****************************************************************************************/
/*********** THE ERROR IS *********************************************************/
bash-2.03# gcc -I /usr/local/tcl84/include/ -o tksam tksam.c -L/usr/local/tcl84/lib/libtcl8.4.a -L/usr/local/tcl84/lib/libtk8.4.a
tksam.c: In function `main':
tksam.c:15: warning: assignment makes pointer from integer without a cast
Undefined first referenced
symbol in file
Tcl_Eval /var/tmp/ccRCTzPY.o
Tk_CreateMainWindow /var/tmp/ccRCTzPY.o
Tcl_Init /var/tmp/ccRCTzPY.o
Tk_Init /var/tmp/ccRCTzPY.o
Tk_MainLoop /var/tmp/ccRCTzPY.o
Tcl_CreateInterp /var/tmp/ccRCTzPY.o
ld: fatal: Symbol referencing errors. No output written to tksam
collect2: ld returned 1 exit status