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