Tcl Source Code

View Ticket
Login
Ticket UUID: 3010850
Title: unable to link tcl in gcc
Type: Bug Version: obsolete: 8.4.19
Submitter: prince-george Created on: 2010-06-03 06:23:32
Subsystem: 69. Other Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2010-06-03 17:23:19
Resolution: Invalid Closed By: dkf
    Closed on: 2010-06-03 10:23:19
Description:
i hv attached a file with very few C code lines.i am able to compile but failed at linking the C code. on typing gcc tcl_c.c i am getting following erro in the terminal.
/tmp/ccPfH310.o: In function `main':
tcl_c.c:(.text+0x41): undefined reference to `Tcl_CreateInterp'
collect2: ld returned 1 exit status
OS platform:Linux 2.6.32-22-generic
I have successfully compiled and installed the Tcl.
User Comments: dkf added on 2010-06-03 17:23:19:

allow_comments - 1

1) Your code should call Tcl_FindExecutable before Tcl_CreateInterp (so that the Tcl library can initialize itself); see the documentation for how to do that.

2) Your bug is that you should also link against the Tcl library; compilers aren't smart enough to work that out for themselves (should be? Maybe, but definitely aren't). This might be as simple as adding -ltcl to where you call the compiler, or might also require telling the compiler/linker where to look (with -L/path/to/libdir).

flatworm added on 2010-06-03 15:57:41:
Not a bug: you most probably failed to link your code with libtcl of appropriate version.
Refer to http://wiki.tcl.tk/3474 , search for the word "embed" on wiki.tcl.tk and if this doesn't help ask for help on the comp.lang.tcl newsgroup (accessible via http://groups.google.com/group/comp.lang.tcl).

The bug may (and should) be closed.

P.S.
Also please note that Tcl 8.4.18 is very outdated as 8.5 is now the stable release and 8.6 is knocking at the door.

prince-george added on 2010-06-03 13:25:35:
i am using tcll8.4.18

prince-george added on 2010-06-03 13:23:33:

File Added - 376051: tcl_c.c

Attachments: