C++ library problem?

poruka: 10
|
čitano: 2.262
|
moderatori: Lazarus Long, XXX-Man, vincimus
1
+/- sve poruke
ravni prikaz
starije poruke gore
16 godina
neaktivan
offline
C++ library problem?
pitanje

 

Dakle uzeo sam jedan open-source programcic koji simulira kreaciju Warcraft III mape (koristeci B.Net protokole) i to sve. Moddao sam (koliko mi C++ znanje, dakle improviziram, i orijentacija u tuđem kodu dopusta, dobro je komentirana pa shvacam kak sve tocno radi). No sada sam skinuo sve nepotrebno headere i source fileove te dosta variabli, komandi, procedura, funkcija - htio sam samo client koji visi na B.Netu te ima bazu istu kao i pocetna, samo sam maknuo neke komande koje unose stvari. Ovo je Build Release i Build Debug log:

 

------ Build started: Project: ghost, Configuration: Release Win32 ------
Linking...
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__hashPassword@8
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__nls_free@4
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__nls_get_M1@16
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__nls_init_l@16
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__nls_get_A@8
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__extractMPQNumber@4
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__getExeInfo@20
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getHash(char *)" (__imp_?getHash@CDKeyDecoder@@QAEIPAD@Z)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::calculateHash(unsigned int,unsigned int)" (__imp_?calculateHash@CDKeyDecoder@@QAEIII@Z)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getVal1(void)" (__imp_?getVal1@CDKeyDecoder@@QAEIXZ)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getProduct(void)" (__imp_?getProduct@CDKeyDecoder@@QAEIXZ)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CDKeyDecoder::isKeyValid(void)" (__imp_?isKeyValid@CDKeyDecoder@@QAEHXZ)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CDKeyDecoder::~CDKeyDecoder(void)" (__imp_??1CDKeyDecoder@@UAE@XZ)
bncsutilinterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CDKeyDecoder::CDKeyDecoder(char const *,unsigned int)" (__imp_??0CDKeyDecoder@@QAE@PBDI@Z)
bncsutilinterface.obj : error LNK2001: unresolved external symbol __imp__checkRevisionFlat@24
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnectTimedOut(class CBNET *)" (?EventBNETConnectTimedOut@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETLoggedIn(class CBNET *)" (?EventBNETLoggedIn@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETDisconnected(class CBNET *)" (?EventBNETDisconnected@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnected(class CBNET *)" (?EventBNETConnected@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnecting(class CBNET *)" (?EventBNETConnecting@CGHost@@QAEXPAVCBNET@@@Z)
C:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\ghost\Release\ghost.exe : fatal error LNK1120: 20 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\ghost\Release\BuildLog.htm"
ghost - 21 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

 

------ Build started: Project: ghost, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__nls_init_l@16 referenced in function "public: __thiscall NLS::NLS(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 &)" (??0NLS@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__nls_free@4 referenced in function "public: virtual __thiscall NLS::~NLS(void)" (??1NLS@@UAE@XZ)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__checkRevisionFlat@24 referenced in function "public: bool __thiscall CBNCSUtilInterface::HELP_SID_AUTH_CHECK(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> >,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> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >)" (?HELP_SID_AUTH_CHECK@CBNCSUtilInterface@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0000V?$vector@EV?$allocator@E@std@@@3@1@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__extractMPQNumber@4 referenced in function "public: bool __thiscall CBNCSUtilInterface::HELP_SID_AUTH_CHECK(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> >,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> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >)" (?HELP_SID_AUTH_CHECK@CBNCSUtilInterface@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0000V?$vector@EV?$allocator@E@std@@@3@1@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__getExeInfo@20 referenced in function "public: bool __thiscall CBNCSUtilInterface::HELP_SID_AUTH_CHECK(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> >,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> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >,class std::vector<unsigned char,class std::allocator<unsigned char> >)" (?HELP_SID_AUTH_CHECK@CBNCSUtilInterface@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0000V?$vector@EV?$allocator@E@std@@@3@1@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__nls_get_A@8 referenced in function "public: void __thiscall NLS::getPublicKey(char *)" (?getPublicKey@NLS@@QAEXPAD@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__nls_get_M1@16 referenced in function "public: void __thiscall NLS::getClientSessionKey(char *,char const *,char const *)" (?getClientSessionKey@NLS@@QAEXPADPBD1@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol __imp__hashPassword@8 referenced in function "public: bool __thiscall CBNCSUtilInterface::HELP_PvPGNPasswordHash(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?HELP_PvPGNPasswordHash@CBNCSUtilInterface@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CDKeyDecoder::~CDKeyDecoder(void)" (__imp_??1CDKeyDecoder@@UAE@XZ) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getHash(char *)" (__imp_?getHash@CDKeyDecoder@@QAEIPAD@Z) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::calculateHash(unsigned int,unsigned int)" (__imp_?calculateHash@CDKeyDecoder@@QAEIII@Z) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getVal1(void)" (__imp_?getVal1@CDKeyDecoder@@QAEIXZ) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall CDKeyDecoder::getProduct(void)" (__imp_?getProduct@CDKeyDecoder@@QAEIXZ) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CDKeyDecoder::isKeyValid(void)" (__imp_?isKeyValid@CDKeyDecoder@@QAEHXZ) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bncsutilinterface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CDKeyDecoder::CDKeyDecoder(char const *,unsigned int)" (__imp_??0CDKeyDecoder@@QAE@PBDI@Z) referenced in function "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall CBNCSUtilInterface::CreateKeyInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?CreateKeyInfo@CBNCSUtilInterface@@AAE?AV?$vector@EV?$allocator@E@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@II@Z)
bnet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnecting(class CBNET *)" (?EventBNETConnecting@CGHost@@QAEXPAVCBNET@@@Z) referenced in function "public: bool __thiscall CBNET::Update(void *)" (?Update@CBNET@@QAE_NPAX@Z)
bnet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnectTimedOut(class CBNET *)" (?EventBNETConnectTimedOut@CGHost@@QAEXPAVCBNET@@@Z) referenced in function "public: bool __thiscall CBNET::Update(void *)" (?Update@CBNET@@QAE_NPAX@Z)
bnet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnected(class CBNET *)" (?EventBNETConnected@CGHost@@QAEXPAVCBNET@@@Z) referenced in function "public: bool __thiscall CBNET::Update(void *)" (?Update@CBNET@@QAE_NPAX@Z)
bnet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CGHost::EventBNETDisconnected(class CBNET *)" (?EventBNETDisconnected@CGHost@@QAEXPAVCBNET@@@Z) referenced in function "public: bool __thiscall CBNET::Update(void *)" (?Update@CBNET@@QAE_NPAX@Z)
bnet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CGHost::EventBNETLoggedIn(class CBNET *)" (?EventBNETLoggedIn@CGHost@@QAEXPAVCBNET@@@Z) referenced in function "public: void __thiscall CBNET::ProcessPackets(void)" (?ProcessPackets@CBNET@@QAEXXZ)
C:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\ghost\Debug\ghost.exe : fatal error LNK1120: 20 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\ghost\Debug\BuildLog.htm"
ghost - 21 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

Zanima me, kako bi to proradilo te ukratko objasnjenje o tim Library-ima te .obj fileovima (u smislu kako bi to proradilo sada) jer zaista sam samo micao stvari a nista nisam dodavao a compile svega pojedinacno zaista radi. S orginalnim sam dobio sve library-e poput StormLib, zlib etc. te su koristeni neki iz standardni poput time.h, string, sstream etc.

EP35-DS3 // Q6600@3.0GHz 1.2875V // Zotac AMP2 GTX260 OC // 2x2OCZ Platinum XTC @ 1069MHz 2.1V // HD Hitachi 500 gig 32 MB cache
Poruka je uređivana zadnji put sri 4.3.2009 0:07 (kajmak).
Moj PC  
0 0 hvala 0
17 godina
offline
C++ library problem?

Vjerojatno se definicija neke funkcije ne poklapa s deklaracijom.

 
0 0 hvala 0
16 godina
neaktivan
offline
C++ library problem?
autorov komentar

Budem sutra pogledao, no takve stvari mi compiler javlja te sam ispravio negdje 700 (iskreno toliko). Budem maknuo sqlite database podrsku i input komande (tj. jos oguliti na sam client za Battle.Net te probat.

EP35-DS3 // Q6600@3.0GHz 1.2875V // Zotac AMP2 GTX260 OC // 2x2OCZ Platinum XTC @ 1069MHz 2.1V // HD Hitachi 500 gig 32 MB cache
Moj PC  
0 0 hvala 0
17 godina
protjeran
offline
C++ library problem?
prihvaćeno rješenje

Stvar je poprilično jasna, a to je da postoje definicije (prototipi) navedenih funkcija ali compiler ne može naći njihova tijela. Ovo je čest slučaj kada se dll statičkim putem povezuje s aplikacijom, a programer zaboravi u projekt uključiti LIB biblioteku tog dll-a. Znači, vjerovatno si uključio sva potrebna zaglavlja, ali ne i biblioteke u kojima se nalaze tijela funkcija.

Moj PC  
0 0 hvala 0
16 godina
neaktivan
offline
C++ library problem?
autorov komentar

Stvar sam popravio donekle jer sam uzeo novi .sln file s ukljucenim BNSCUtil u project (a to je .dll file koji je vec napravljen ali kaj sad) te sad je ostalo jos samo ovo!

 

------ Build started: Project: ghost, Configuration: Release Win32 ------
Linking...
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnectTimedOut(class CBNET *)" (?EventBNETConnectTimedOut@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETLoggedIn(class CBNET *)" (?EventBNETLoggedIn@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETDisconnected(class CBNET *)" (?EventBNETDisconnected@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnected(class CBNET *)" (?EventBNETConnected@CGHost@@QAEXPAVCBNET@@@Z)
bnet.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGHost::EventBNETConnecting(class CBNET *)" (?EventBNETConnecting@CGHost@@QAEXPAVCBNET@@@Z)
C:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\Release\ghost.exe : fatal error LNK1120: 5 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\CHAT BOT PROJECT\ghost\Release\BuildLog.htm"
ghost - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Dakle, fali mi nesto u samom kodu ili library? Oprosti sto sam teski noob, u skoli smo tek na Procedurama u Turbo Pascalu xD te kako cu uopce naci gdje se te funkcije nalaze jer EventBNETLoggedIn(class CBNET *)

je to definirano u ghost.h pa ne znam u cem je problem.

EP35-DS3 // Q6600@3.0GHz 1.2875V // Zotac AMP2 GTX260 OC // 2x2OCZ Platinum XTC @ 1069MHz 2.1V // HD Hitachi 500 gig 32 MB cache
Poruka je uređivana zadnji put sri 4.3.2009 7:31 (kajmak).
Moj PC  
0 0 hvala 0
17 godina
protjeran
offline
C++ library problem?

Pronađi sve .LIB datoteke i uključi ih u projekt.

Moj PC  
0 0 hvala 0
17 godina
neaktivan
offline
C++ library problem?

Ili promijeni kod tako da koristi DLL direktno bez libova koje nemaš.

LOL @ http://www.youtube.com/watch?v=Y_uCjnuY9D4
Moj PC  
0 0 hvala 0
17 godina
protjeran
offline
RE: C++ library problem?
naxeem kaže...

Ili promijeni kod tako da koristi DLL direktno bez libova koje nemaš.

To mi se ne čini baš isplativo jer to bi zahtjevalo potpunu redefiniciju prototipa svih eksportabilnih dll funkcija (deklarirati ih kao pokazivače na funkcije koji se kasnije inicijaliziraju kroz GetProcAddress). Da je riječ o svega par funkcija bilo bi isplativo, ali ovako je najjednostavnije samo uključiti LIB i rješio si sve probleme.
17 godina
neaktivan
offline
C++ library problem?

Dobio sam dojam da baš i nema izbora...

LOL @ http://www.youtube.com/watch?v=Y_uCjnuY9D4
Moj PC  
0 0 hvala 0
16 godina
neaktivan
offline
C++ library problem?
autorov komentar

EDIT broj 10000#:

 

Ipak sam uspio, sve je bila dakako moja greska, oprostite - idem u skolu, radimo Turbo Pascal a dvije godine nam treba da naucimo napisati - Program Blabla; var a:integer; BEGIN writeln('lol'); read(a); writeln(a,' lol'); END. - a ja evo radim malo na C++u jer mi je vezano uz igranje W3-a i Dotu :P

 

Također Tracerov post koji sam oznacio na kraju je odgovor - nije bilo tijela funkcija!

EP35-DS3 // Q6600@3.0GHz 1.2875V // Zotac AMP2 GTX260 OC // 2x2OCZ Platinum XTC @ 1069MHz 2.1V // HD Hitachi 500 gig 32 MB cache
Poruka je uređivana zadnji put sri 4.3.2009 14:16 (kajmak).
Moj PC  
0 0 hvala 0
1
Nova poruka
E-mail:
Lozinka:
 
vrh stranice