Compile problem with TCL interpreter

Discussion in 'C++' started by David Swedish, Feb 6, 2004.

  1. 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;
    Tcl_FindExecutable(filename);
    char *file = argv[1];

    #ifdef _MSC_VER

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

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

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

    //Create TCL interpreter
    Tcl_Interp* interp;

    interp = Tcl_CreateInterp();
    Tcl_Init(interp);

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

    cout << interp->result;

    }

    //Free memory
    Tcl_DeleteInterp(interp);

    return 0;
    }
    David Swedish, Feb 6, 2004
    #1
    1. Advertising

  2. David  Swedish

    Guest

    (David Swedish) wrote in message news:<>...
    [snip]
    > 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.
    Socks
    , Feb 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DE
    Replies:
    6
    Views:
    348
    Jeff Epler
    Feb 24, 2005
  2. Nagaraj
    Replies:
    1
    Views:
    825
    Lionel B
    Mar 1, 2007
  3. Mark Wilson
    Replies:
    0
    Views:
    89
    Mark Wilson
    Aug 24, 2003
  4. Mumia W.

    Inline::Tcl vs. Inline::Tcl

    Mumia W., Aug 23, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    121
    Mumia W.
    Aug 23, 2006
  5. Filippo

    drive externally a tcl interpreter

    Filippo, Sep 26, 2006, in forum: Perl Misc
    Replies:
    1
    Views:
    79
    Ben Morrow
    Sep 26, 2006
Loading...

Share This Page