I am trying to create a simple C ++ console application that calls nagelfar syntax check on a script. I followed the directions here: http://wiki.tcl.tk/19919 , adding tclstub85.lib to my input, adding the tcl lib directory to my additional libraries and adding my header directory. Communication failure with:
main.obj : error LNK2001: unresolved external symbol _tclStubsPtr
This is my command line for the link:
/OUT:"C:\Users\######\Documents\Visual Studio 2005\Projects\Nagelfar\Release\Nagelfar.exe" /NOLOGO /LIBPATH:"C:\Tcl\lib" /MANIFEST /MANIFESTFILE:"Release\Nagelfar.exe.intermediate.manifest" /DEBUG /PDB:"c:\users\######\documents\visual studio 2005\projects\nagelfar\release\Nagelfar.pdb" /OPT:REF /OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT C:\Tcl\lib\tclstub85.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
This is the complete source code that I can compile and execute perfectly on Linux using g ++:
#include <stdlib.h> #include <stdio.h> #include <tcl.h> #include <string.h> Tcl_Interp * tcl_interp ; char fileToCheck[] = "test.tcl"; char dbFile[] = "syntaxdb.tcl"; int main () { int code, argc; const char **argv; char command[1024]; char *results = NULL; tcl_interp = Tcl_CreateInterp(); Tcl_SetVar2(tcl_interp, "::Nagelfar", "embedded", "1", 0); code = Tcl_EvalFile(tcl_interp, "nagelfar.tcl"); Tcl_LinkVar(tcl_interp, "::Nagelfar(chkResult)", (char *)&results, TCL_LINK_STRING); sprintf(command, "synCheck %s %s", fileToCheck, dbFile); code = Tcl_Eval(tcl_interp, command); printf("Raw Result: \r\n %s\r\n", results); code = Tcl_SplitList(tcl_interp, results, &argc, &argv); { int i; for (i = 0; i < argc; ++i) { printf("%d/%d: %s\r\n", i+1, argc, argv[i]); } } Tcl_Free(results); return 0; }
Solved my own problem: I had x64 ActiveTcl, but a 32-bit project was linked. Using x86 ActiveTcl distribution fixed my problems.