I am trying to create a simple c++ console app that calls the nagelfar syntax checker on a script. I followed the directions here: http://wiki.tcl.tk/19919 , adding the tclstub85.lib
to my input, adding the tcl lib directory to my additional libraries, and adding my header directory as well. Linking fails with:
main.obj : error LNK2001: unresolved external symbol _tclStubsPtr
This is my command line for linking:
/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 full source code, which I can compile and run fine in 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 was linking a 32 bit project. Using the x86 ActiveTcl distribution fixed my issues.
Solved my own problem: I had x64 ActiveTcl but was linking a 32 bit project. Using the x86 ActiveTcl distribution fixed my issues.