11

विजुअल स्टूडियो 2012 त्रुटि को ठीक करने के लिए कैसे करें LNK2019: अनसुलझा बाहरी प्रतीक" __declspec (dllimport) सार्वजनिक: कक्षा std :: basic_string?विजुअल स्टूडियो 2012 त्रुटि को कैसे ठीक करें LNK2019: अनसुलझा बाहरी प्रतीक "__declspec (dllimport) सार्वजनिक: कक्षा std :: basic_string?

मैं एक समाधान एक exe और कई स्थिर lib परियोजनाओं जिस पर exe को विजुअल स्टूडियो 2008 के साथ ठीक निर्भर करता युक्त संकलन किया गया है स्थिर libs में शामिल हैं:

  • TCL: tcl84tsx.lib
  • wxWidgets: wxbase.lib
  • zlib.lib
  • ws2_32.lib
  • xerces-c_2.lib
  • एस.एन. सांसद रिसर्च निर्गत होना: subagent.lib, agent.lib, emanate.lib, pack.lib, mibtable.lib, devkit.lib
  • आदि

मैं Visual Studio 2012 में समाधान लोड और सभी संकलित किया है समाधान में परियोजनाएं, लेकिन जब मैं exe को जोड़ने का प्रयास करता हूं, तो मुझे नीचे दिए गए आउटपुट जैसे मानक C++ लाइब्रेरी में सामानों के लिए अनसुलझे प्रतीकों के बारे में त्रुटियां मिल रही हैं।

मुझे इस तरह के अनसुलझे प्रतीकों के साथ बहुत से लोगों को मिला है लेकिन कोई भी फिक्स मेरे लिए काम नहीं कर रहा है। ठीक करता है मैं कोशिश की है अब तक शामिल

  • स्थिर lib परियोजनाओं के लिए मैन्युअल रूप से जोड़ना संदर्भ जिस पर exe परियोजना निर्भर करता है
  • टॉगल द्वारा EXE परियोजना अद्यतन कर रहा है "wchar_t के रूप में इलाज में निर्मित प्रकार" लिंकर विकल्प
  • Visual Studio 2012 लिंकर से

आउटपुट ...

1>ace_funcs.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification 
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 
1>ComponentX-Win32.lib(MyOrgConsoleSktServer.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentY-Win32.lib(ORBSingleton.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentY-Win32.lib(OrbException.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(ExceptionHelper.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(ComponentCCheckpointImpl.obj) : warning LNK4217: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>ComponentX-Win32.lib(MyOrgConsole.obj) : warning LNK4049: locally defined symbol ??0?$basic_s[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentX-Win32.lib(MyOrgThreadFactory.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(PersistenceServiceProxy.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(ComponentBServiceImpl.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(XmlPreferencesHelper.obj) : warning LNK4217: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported in function "private: void __thiscall _CORBA_Sequence_String::copybuffer(unsigned long)" ([email protected][email protected]@[email protected]) 
1>ComponentZ-Win32.lib(XmlHelper.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : warning LNK4217: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>ComponentA-Win32.lib(propertyutil.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentA-Win32.lib(SystemEnvironment.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentZ-Win32.lib(PersistenceClient.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported 
1>ComponentY-Win32.lib(OrbException.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported 
1>ComponentX-Win32.lib(MyOrgConsole.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported 
1>ComponentX-Win32.lib(MyOrgThreadFactory.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported 
1>ComponentX-Win32.lib(MyOrgConsoleSktServer.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported 
1>ComponentY-Win32.lib(ORBSingleton.obj) : warning LNK4217: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported in function "public: virtual __thiscall OrbException::~OrbException(void)" ([email protected]@[email protected]) 
1>ComponentZ-Win32.lib(XmlPreferencesHelper.obj) : warning LNK4049: locally defined symbol [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected] (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported 
-- snip -- 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::substr(unsigned int,unsigned int)const " ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "private: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall ServiceBootstrap::trimmed(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::find_last_not_of(char const *,unsigned int,unsigned int)const " ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "private: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall ServiceBootstrap::trimmed(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::find_first_not_of(char const *,unsigned int,unsigned int)const " ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "private: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall ServiceBootstrap::trimmed(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "private: void __thiscall ServiceBootstrap::verifyBootstrapProperties(void)" ([email protected]@@AAEXXZ) 
1>ComponentZ-Win32.lib(PersistenceServiceProxy.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>ComponentA-Win32.lib(ServiceBootstrap.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(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 &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<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> > > > > __thiscall ServiceBootstrap::getBootstrapProperties(void)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected][email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@XZ) 
1>ComponentZ-Win32.lib(PersistenceServiceProxy.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(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 &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>ComponentA-Win32.lib(propertyutil.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Mutex::_Lock(void)" ([email protected][email protected]@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Sentry_base::_Sentry_base(class std::basic_ostream<char,struct std::char_traits<char> > &)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected]@@Z) 
1>ComponentZ-Win32.lib(XmlHelper.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Mutex::_Lock(void)" ([email protected][email protected]@@QAEXXZ) 
-- snip -- 
1>.\Debug/sComponentC.exe : fatal error LNK1120: 22 unresolved externals 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
+0

प्रोजेक्ट गुणों में – TheMathemagician

+2

कथन शामिल करने से किसी भी .h के को हटाने का प्रयास करें, ** प्लेटफ़ॉर्म टूलसेट ** को * VS2008 (v90) * और अपनी स्थापना के आधार पर सही निर्देशिकाएं सेट करें (यानी: शामिल => * सी: \ प्रोग्राम फ़ाइलें (x86) \ विंडोज किट \ 8.0 \ शामिल \ साझा; सी: \ प्रोग्राम फ़ाइलें (x86) \ विंडोज किट \ 8.0 \ \ um; $ (IncludePath) * और पुस्तकालय => * सी: \ प्रोग्राम फ़ाइलें (x86 शामिल करें) \ विंडोज किट \ 8.0 \ Lib \ win8 \ um \ x64; $ (लाइब्रेरीपाथ) *)। लिंक प्रविष्टियों में .lib सेट करना न भूलें। – Xaruth

+0

गुगलिंग के दौरान, मैंने प्लेटफार्म टूलसेट चाल देखी। इस बड़ी कंपनी में, जो भी एमएसवीसी ++ के लिए एमएसआई स्थापित करता है, उसमें v90 शामिल नहीं है। तो मेरे एमएसबिल्ड फ़ोल्डर में केवल v10 के लिए टूलसेट परिभाषा है। मैं इसे ट्रैक करने की कोशिश करूंगा। वैकल्पिक रूप से, अगर मैं लिंकर मुद्दे को समझ सकता हूं तो मैं सभी निर्भरताओं का पुनर्निर्माण करने के साथ ठीक हूं। – buzz3791

उत्तर

2

गुण में> C/C++ -> Laguage, मैं wchar_t इलाज के रूप में नहीं करने के लिए प्रकार में बनाया गया है और यह मेरी समस्या हल की स्थापना की।

2

आप पहले से ही विकल्प नीचे की कोशिश की है, तो:

  • मैन्युअल स्थिर lib परियोजनाओं के लिए संदर्भ जिस पर exe परियोजना निर्भर करता है
  • टॉगल करने से जोड़कर EXE परियोजना अद्यतन कर रहा है "wchar_t के रूप में इलाज में निर्मित प्रकार" विकल्प

निम्न चरणों के द्वारा 64 को अपनी परियोजना को विन्यस्त का प्रयास करें:

  • सही चुनें Solution 'ProjectName'
  • पर क्लिक करें Configuration Manager...
  • बदलें परियोजना है जो आप
  • समाधान

यह पुनर्निर्माण Win32 (या शिकंजा विपरीत) से x64 को उदारीकरण फ़ाइल से जोड़ने के लिए कोशिश कर रहे हैं की platform वास्तव में मेरी समस्या का समाधान किया। मुझे पता नहीं था कि मेरा बाहरी lib 32-बिट या 64-बिट के लिए संकलित किया गया है।

0

यहां तक ​​कि मुझे दृश्य स्टूडियो में इस प्रकार की त्रुटियों का सामना करना पड़ा। इस तरह की त्रुटियों का कारण हैं,

1) आपने कई पुस्तकालयों को शामिल किया होगा जो एक-दूसरे से विवाद कर रहे हैं। कभी-कभी, लाइब्रेरी में एक वर्ग अन्य पुस्तकालय में अन्य वर्ग से संघर्ष कर सकती है।

2) आपने निर्देशिकाओं से पुस्तकालयों को शामिल किया होगा। एक बार फिर पुस्तकालयों के पथ की जांच करें।

3) आपको परियोजना गुणों में पुस्तकालयों और शीर्षलेख फ़ाइलों (यदि आपको शामिल करना है) निर्दिष्ट करने की आवश्यकता है। एक बार फिर से जांचें कि पथ सही हैं या नहीं।

संबंधित मुद्दे