Compile problem with TCL interpreter

D

David Swedish

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;
}
 
P

puppet_sock

[email protected] (David Swedish) wrote in message news: said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top