窗口中未解析的外部符号

Unresolved external symbol in windows

本文关键字:外部 符号 窗口      更新时间:2023-10-16

我正在使用Windows8 32位,Visual Studio 2012和Intel pintool(76991版本)。我正在使用开发人员命令提示符使用命令创建dll:

link /DLL /EXPORT:main /NODEFAULTLIB /NOLOGO /INCREMENTAL:NO /MACHINE:x86 /ENTRY:Ptrace_DllMainCRTStartup /BASE:0xC5000000 /OPT:REF /out:obj-ia32/inscount0.dll inscount0.obj shmem_ritu.obj /LIBPATH:C:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsia32lib /LIBPATH:C:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsia32lib-ext /LIBPATH:C:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsextrasxed-ia32lib pin.lib libxed.lib libcpmt.lib libcmt.lib pinvm.lib kernel32.lib C:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsia32lib-extntdll-32.lib
cl -c     -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowssourceinclude -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowssourcetoolsInstLib -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsextrasxed2-ia32include -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowsextrascomponentsinclude  -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowssource/include/gen -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowssource/include/pin -IC:UserskunalDownloadspin-3.0-76991-msvc-windowspin-3.0-76991-msvc-windowssource/include/pin/gen     -DTARGET_IA32E -DHOST_IA32E  -DTARGET_WINDOWS  -IC:minorfilesIncludeInVisualStudio  inscount0.cpp

它给出错误:

LINK : error LNK2001: unresolved external symbol _Ptrace_DllMainCRTStartup
inscount0.obj : error LNK2019: unresolved external symbol "public: void __cdecl LEVEL_BASE::MESSAGE_TYPE::MessageNoReturn(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool,enum PIN_ERRTYPE,int,...)" (?MessageNoReturn@MESSAGE_TYPE@LEVEL_BASE@@QAAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_NW4PIN_ERRTYPE@@HZZ) referenced in function "void __cdecl printip(unsigned int,void *,char *)" (?printip@@YAXIPAXPAD@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::AssertString(char const *,char const *,unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?AssertString@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD0IABV23@@Z) referenced in function "void __cdecl printip(unsigned int,void *,char *)" (?printip@@YAXIPAXPAD@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::StringDec(unsigned __int64,unsigned int,char)" (?StringDec@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_KID@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::decstr(unsigned int,unsigned int)" (?decstr@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@II@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: __thiscall LEVEL_BASE::KNOB_BASE::KNOB_BASE(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum LEVEL_BASE::KNOB_MODE)" (??0KNOB_BASE@LEVEL_BASE@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0000W4KNOB_MODE@1@@Z) referenced in function "public: __thiscall LEVEL_BASE::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(enum LEVEL_BASE::KNOB_MODE,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$KNOB@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@QAE@W4KNOB_MODE@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1111@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::KNOB_BASE::StringKnobSummary(void)" (?StringKnobSummary@KNOB_BASE@LEVEL_BASE@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "int __cdecl Usage(void)" (?Usage@@YAHXZ)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_CORE::INS_Disassemble(class LEVEL_CORE::INDEX<6>)" (?INS_Disassemble@LEVEL_CORE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$INDEX@$05@1@@Z) referenced in function "void __cdecl Instruction(class LEVEL_CORE::INDEX<6>,void *)" (?Instruction@@YAXV?$INDEX@$05@LEVEL_CORE@@PAX@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl LEVEL_PINCLIENT::RTN_Name(class LEVEL_CORE::INDEX<3>)" (?RTN_Name@LEVEL_PINCLIENT@@YAABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$INDEX@$02@LEVEL_CORE@@@Z) referenced in function "void __cdecl FlagRtn(class LEVEL_CORE::INDEX<3>,void *)" (?FlagRtn@@YAXV?$INDEX@$02@LEVEL_CORE@@PAX@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static unsigned __int64 __cdecl LEVEL_BASE::KNOBVALUE<unsigned __int64>::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@_K@LEVEL_BASE@@SA_KABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<unsigned __int64>::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@_K@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<unsigned __int64>::Type(void)" (?Type@?$KNOBVALUE@_K@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<unsigned __int64>::Type(void)" (?Type@?$KNOB@_K@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
inscount0.obj : error LNK2019: unresolved external symbol "public: static __int64 __cdecl LEVEL_BASE::KNOBVALUE<__int64>::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@_J@LEVEL_BASE@@SA_JABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<__int64>::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@_J@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<__int64>::Type(void)" (?Type@?$KNOBVALUE@_J@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<__int64>::Type(void)" (?Type@?$KNOB@_J@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Type(void)" (?Type@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Type(void)" (?Type@?$KNOB@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
pin.lib(reg.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(cfg_ia32.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(ipc_common_windows.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(ipc_connection_windows.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(modules_win.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(elf_windows.obj) : error LNK2019: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z) referenced in function "class LEVEL_CORE::INDEX<21> __cdecl LEVEL_CORE::FindLinkerDefinedSymbol(class std::basic_string<char,class std::char_traits<char>,class std::allocator<char> > const &)" (?FindLinkerDefinedSymbol@LEVEL_CORE@@YA?AV?$INDEX@$0BF@@1@ABV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

在互联网上,我发现由于以下原因,我可能会收到此错误"尝试在调试模式下构建 Pintool。将Visual Studio中的活动配置更新为"发布",链接错误将消失"

我需要包含哪个标志才能在发布模式下构建它(因为我正在使用命令提示符)?

我不确定这是否仍然需要,但我相信您没有将 pintool 与 crtbeginS.o 链接。尝试将此对象文件作为链接命令中的第一个文件添加。