Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Compile problem with TCL interpreter

Thread Tools

Compile problem with TCL interpreter

David Swedish
Posts: n/a
Hi all!

I have made a C++ program that reads and interprets a TCL-script. I
have actually succeeded to compile it in Visual Studio, but to avoid
Windows I want to compile it on linux (using redhat).

I have installed TCL with the header-files tcl.h, tclDecls.h aso, as
well as the library file tcl84.lib. Is there anything else I need?
When trying to compile with g++ I get the error "undefined reference
to Tcl_CreateInterp", "undefined reference to Tcl_Init" aso.

Anyone has a clue what is wrong?

/David (Swedish)

My source code:

#include <iostream.h>
#include <tcl.h>
#include <string>
using namespace std;

int main(int argc, char *argv[]){

char *filename;
char *file = argv[1];

#ifdef _MSC_VER

/* Only do this when MSVC++ is compiling us. */

/* Mark this .obj as needing tcl's Stubs library.*/
# pragma comment(lib, "tclstub" \
# else

/* Mark this .obj needing the import library */
# pragma comment(lib, "tcl" \
# endif

//Create TCL interpreter
Tcl_Interp* interp;

interp = Tcl_CreateInterp();

int test = Tcl_EvalFile(interp, file);
if(test == 1){

cout << interp->result;


//Free memory

return 0;
Reply With Quote
Posts: n/a
      02-06-2004 Removed) (David Swedish) wrote in message news:<(E-Mail Removed) om>...
> When trying to compile with g++ I get the error "undefined reference
> to Tcl_CreateInterp", "undefined reference to Tcl_Init" aso.

At compile or at link?

If it's a compile message, maybe you have not got the right
header file.

If it's a link message, maybe you are missing a library.

Either way, it sounds like a problem to do with the specifics
of TCL, and not a language issue.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to build a loadable tcl dll with visual studio (microsoft C compiler)?[crosspost in comp.lang.tcl and comp.lang.c++] Michael Reichenbach C++ 5 02-08-2010 02:38 PM
drive externally a tcl interpreter Filippo Perl Misc 1 09-26-2006 09:33 PM
Inline::Tcl vs. Inline::Tcl Mumia W. Perl Misc 0 08-23-2006 04:09 PM
Attaching to a Python Interpreter a la Tcl DE Python 6 02-24-2005 01:49 PM
Ruby tcltklib includes a Tcl interpreter Mark Wilson Ruby 0 08-24-2003 07:55 PM