TCL:在windows中链接静态库

TCL:在windows中链接静态库,c,compilation,tcl,static-libraries,C,Compilation,Tcl,Static Libraries,我已经从下载了TCL源代码,我可以使用以下命令在Windows7中编译它以生成静态库 nmake -f makefile.vc OPTS=static INSTALLDIR=path_to_your_install_dir nmake -f makefile.vc install OPTS=static INSTALLDIR=path_to_your_install_dir 在输出中,我可以得到tcl87s.lib-tclds14s.lib-tclreg13s.lib 现在我正在尝试构建我的C

我已经从下载了TCL源代码,我可以使用以下命令在Windows7中编译它以生成静态库

nmake -f makefile.vc OPTS=static INSTALLDIR=path_to_your_install_dir
nmake -f makefile.vc install OPTS=static INSTALLDIR=path_to_your_install_dir
在输出中,我可以得到
tcl87s.lib-tclds14s.lib-tclreg13s.lib

现在我正在尝试构建我的C代码(嵌入了TCL):

因为我需要在Windows中构建它,所以我正在Visual Studio命令提示符中编译以下代码:

cl -I"D:\path\to\tcl\include" myCode.c D:\path\to\tcl87s.lib
但不幸的是,我总是遇到以下错误:

error LNK2019: unresolved external symbol __imp__Tcl_Alloc referenced in function ...
error ....................................__imp__Tcl_Free ..................
error ....................................__imp__Tcl_CreateInterp ..................
以及其他TCL功能的更多错误


如果我将TCL构建为一个动态库,就不会出现错误,而且我可以编译我的C代码。有人知道问题出在哪里吗

事实证明,在编译我的C代码时,我必须使用flag-DSTATIC_BUILD。

唉,你需要在Windows上构建的人的建议。这是一个我不用于开发的平台;我没有这方面的工具链(更不用说你拥有的工具链了),而且我对项目在那里的工作方式几乎没有经验。但是,该消息似乎表明函数没有绑定到它们的实现,并且表明缺少库。Tcl库的绑定方式根据链接选项的不同而不同;在静态链接中,它应该直接指向命名函数,而不是它们的导入存根。@DonalFellows。。谢谢你的回复。。事实证明,在编译C代码时,我必须使用flag-DSTATIC_BUILD。
error LNK2019: unresolved external symbol __imp__Tcl_Alloc referenced in function ...
error ....................................__imp__Tcl_Free ..................
error ....................................__imp__Tcl_CreateInterp ..................