By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,838 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,838 IT Pros & Developers. It's quick & easy.

Compile problem with TCL interpreter

P: 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;
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;
}
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
bl****@hotmail.com (David Swedish) wrote in message news:<6c*************************@posting.google.c om>...
[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
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.