Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compilation Error

Status
Not open for further replies.

mistkhan

Technical User
May 31, 2003
14
0
0
IN
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], &quot;Tk&quot;);
if (mainWindow == NULL) {
fprintf(stderr, &quot;%s\n&quot;, interp->result);
exit(1);
}

if (Tcl_Init(interp) == TCL_ERROR) {
fprintf(stderr, &quot;Tcl_Init failed: %s\n&quot;, interp->result);
}
if (Tk_Init(interp) == TCL_ERROR) {
fprintf(stderr, &quot;Tk_Init failed: %s\n&quot;, interp->result);
}

Tcl_Eval(interp, &quot;button .hello -text \&quot;Hello World\&quot; -command \&quot;destroy .\&quot;&quot;);
Tcl_Eval(interp, &quot;pack .hello&quot;);
Tk_MainLoop();
Tcl_Eval(interp, &quot;exit&quot;);
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top