简体   繁体   中英

Unresolved external using TCL/Tk in c++ applikation on Windows with cpptk

I'm trying to get started with Tcl/tk from a c++ app.

I use the following:

I have included all the necessary header files and also linked to both boost and Tcl. In cpptkbase.cc I have added

#define shared_ptr boost::boost::shared_ptr    and
#define exception std::exception   (known issues according to google)

When trying to compile i get:

1>------ Build started: Project: tcl, Configuration: Debug Win32 ------
1>  tcl.cpp
1>  stdafx.cpp
1>  cpptkbase.cc
1>c:\program\microsoft visual studio 10.0\vc\include\xutility(2227): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1>          c:\program\microsoft visual studio 10.0\vc\include\xutility(2212) : see declaration of 'std::_Copy_impl'
1>          x:\mycodes\archiv\tcl\tcl\tcl\cpptkbase.cc(138) : see reference to function template instantiation '_OutIt std::copy<std::_String_iterator<_Elem,_Traits,_Alloc>,char*>(_InIt,_InIt,_OutIt)' being compiled
1>          with
1>          [
1>              _OutIt=char *,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>,
1>              _InIt=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>
1>          ]
1>  cpptk.cc
1>  Generating Code...
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_Eval referenced in function "public: __thiscall `anonymous namespace'::Interp::Interp(void)" (??0Interp@?A0x9fc9ee39@@QAE@XZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tk_Init referenced in function "public: __thiscall `anonymous namespace'::Interp::Interp(void)" (??0Interp@?A0x9fc9ee39@@QAE@XZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_Init referenced in function "public: __thiscall `anonymous namespace'::Interp::Interp(void)" (??0Interp@?A0x9fc9ee39@@QAE@XZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_CreateInterp referenced in function "public: __thiscall `anonymous namespace'::Interp::Interp(void)" (??0Interp@?A0x9fc9ee39@@QAE@XZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_UpdateLinkedVar referenced in function "void __cdecl `anonymous namespace'::linkCpptoTcl(void)" (?linkCpptoTcl@?A0x9fc9ee39@@YAXXZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_Alloc referenced in function "void __cdecl `anonymous namespace'::linkCpptoTcl(void)" (?linkCpptoTcl@?A0x9fc9ee39@@YAXXZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_Free referenced in function "void __cdecl `anonymous namespace'::linkCpptoTcl(void)" (?linkCpptoTcl@?A0x9fc9ee39@@YAXXZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_SetResult referenced in function _callbackHandler
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_CreateObjCommand referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Tk::details::addCallback(class boost::shared_ptr<class Tk::details::CallbackBase>)" (?addCallback@details@Tk@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$shared_ptr@VCallbackBase@details@Tk@@@boost@@@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_LinkVar referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Tk::details::addLinkVar(int &)" (?addLinkVar@details@Tk@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAH@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_UnlinkVar referenced in function "void __cdecl Tk::details::deleteLinkVar(int &)" (?deleteLinkVar@details@Tk@@YAXAAH@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_SetObjResult referenced in function "void __cdecl Tk::details::setResult(bool)" (?setResult@details@Tk@@YAX_N@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_NewBooleanObj referenced in function "void __cdecl Tk::details::setResult(bool)" (?setResult@details@Tk@@YAX_N@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_NewLongObj referenced in function "void __cdecl Tk::details::setResult(long)" (?setResult@details@Tk@@YAXJ@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_NewDoubleObj referenced in function "void __cdecl Tk::details::setResult(double)" (?setResult@details@Tk@@YAXN@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_NewStringObj referenced in function "void __cdecl Tk::details::setResult(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?setResult@details@Tk@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_ListObjLength referenced in function "int __cdecl Tk::details::getResultLen(void)" (?getResultLen@details@Tk@@YAHXZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_GetObjResult referenced in function "int __cdecl Tk::details::getResultLen(void)" (?getResultLen@details@Tk@@YAHXZ)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_GetIntFromObj referenced in function "int __cdecl Tk::details::getResultElem<int>(int)" (??$getResultElem@H@details@Tk@@YAHH@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_ListObjIndex referenced in function "int __cdecl Tk::details::getResultElem<int>(int)" (??$getResultElem@H@details@Tk@@YAHH@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_GetDoubleFromObj referenced in function "double __cdecl Tk::details::getResultElem<double>(int)" (??$getResultElem@N@details@Tk@@YANH@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_GetString referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Tk::details::getResultElem<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(int)" (??$getResultElem@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@details@Tk@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_DeleteCommand referenced in function "void __cdecl Tk::deleteCallback(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?deleteCallback@Tk@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tcl_FindExecutable referenced in function "void __cdecl Tk::init(char *)" (?init@Tk@@YAXPAD@Z)
1>cpptkbase.obj : error LNK2019: unresolved external symbol __imp__Tk_MainLoop referenced in function "void __cdecl Tk::runEventLoop(void)" (?runEventLoop@Tk@@YAXXZ)
1>X:\MyCodes\Archiv\tcl\tcl\Debug\tcl.exe : fatal error LNK1120: 25 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can anyone help me?

您应该tcl85.lib链接TCL导入库(可能是ActiveState TCL文件夹中某处的tcl85.libtcl85<some suffix>.lib )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM