c++ - fatal error LNK1120: 8 unresolved externals -


i'm writing program takes magnet links , uses rcp call remote client , open magnet link in deluge. i'm using xmlrpcc4win rpc lib. i'v spent possibly hour on half on far, of time googling error little or no luck.

the code have follows:

// consoleapplication6.cpp : defines entry point console application. // //this program designed open magnet links on remote server using rpc calls. #include "stdafx.h" #include "timxmlrpc.h" #include <iostream> #include <string> #include <fstream>  //some basic defines... #define basic_opperation 2 #define success 0 #define failure -1  //define funftion prototypes int callrpc(std::string); int checkurl(std::string);   int main(int argc, char* argv[]) {     //convert char* argv[] string error handling.     std::string spassedmagnet = argv[1];     int status;      //chect see if program being opened correct number of params     if(basic_opperation == argc)     {         //check passed link value         checkurl(spassedmagnet);          //start rcp call         status = callrpc(spassedmagnet);          //handle errors         if(success != status)         {             std::cout << "call not successfull" << std::endl;             return failure;         }         //print out success message         std::cout << "call made successfull\n" << std::endl;         std::cout << "hit enter..." << std::endl;         std::cin.get();     }      return success; }   int checkurl(std::string spassedmagnet){          //nice simple bit of code check if link passed in indeed         //a magnet link, or random text of no use.           //define local variables         int status;         std::string scheckmag = ("magnet:");          //check see if string passed in contains 'magnet:'         if (std::string::npos != spassedmagnet.find(scheckmag))         {             std::cout << "found magnet!\n\n" << std::endl;             std::cout << "magnet link: " << spassedmagnet << "\n" << std::endl;             status = success;         }         //handle errors if string not contain :magnet         else         {             std::cout << "that's not magnet link...\n" << std::endl;             std::cout << "press key...\n" << std::endl;             std::cin.get();             status = failure;         }          return status; }  int callrpc(std::string spassedmagnet){      //set client connect     //maybe add scan in config file?     xmlrpcclient connection("localhost:8080/rcp2");     connection.setignorecertificateauthority();      //  call:  add_torrent_magnet(uri, options):     xmlrpcvalue args, result;     args[0] = spassedmagnet;     args[1] = 1;       // replace function name own:     if (! connection.execute("add_torrent_magnet", args, result))      {         std::cout << connection.geterror();     }     //else if (result.gettype() == xmlrpcvalue::typestring)     //{     //  std::cout << std::string(result);     //}     else     {         std::cout << "success\n";     }     return success; } 

so far output when build code follows:

1>------ build started: project: consoleapplication6, configuration: debug win32 ------ 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: class xmlrpcvalue & __thiscall xmlrpcvalue::operator=(class xmlrpcvalue const &)" (??4xmlrpcvalue@@qaeaav0@abv0@@z) referenced in function "public: class xmlrpcvalue & __thiscall xmlrpcvalue::operator=(int const &)" (??4xmlrpcvalue@@qaeaav0@abh@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "protected: void __thiscall xmlrpcvalue::invalidate(void)" (?invalidate@xmlrpcvalue@@iaexxz) referenced in function "public: __thiscall xmlrpcvalue::~xmlrpcvalue(void)" (??1xmlrpcvalue@@qae@xz) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "protected: void __thiscall xmlrpcvalue::assertarray(int)" (?assertarray@xmlrpcvalue@@iaexh@z) referenced in function "public: class xmlrpcvalue & __thiscall xmlrpcvalue::operator[](int)" (??axmlrpcvalue@@qaeaav0@h@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: __thiscall xmlrpcclient::xmlrpcclient(char const *)" (??0xmlrpcclient@@qae@pbd@z) referenced in function "int __cdecl callrpc(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?callrpc@@yahv?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: bool __thiscall xmlrpcclient::execute(char const *,class xmlrpcvalue const &,class xmlrpcvalue &)" (?execute@xmlrpcclient@@qae_npbdabvxmlrpcvalue@@aav2@@z) referenced in function "int __cdecl callrpc(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?callrpc@@yahv?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: void __thiscall xmlrpcclient::setignorecertificateauthority(bool)" (?setignorecertificateauthority@xmlrpcclient@@qaex_n@z) referenced in function "int __cdecl callrpc(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?callrpc@@yahv?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall xmlrpcclient::geterror(void)" (?geterror@xmlrpcclient@@qae?av?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@xz) referenced in function "int __cdecl callrpc(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?callrpc@@yahv?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@z) 1>consoleapplication6.obj : error lnk2019: unresolved external symbol "public: void __thiscall xmlrpcclient::close(void)" (?close@xmlrpcclient@@qaexxz) referenced in function "public: __thiscall xmlrpcclient::~xmlrpcclient(void)" (??1xmlrpcclient@@qae@xz) 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\debug\consoleapplication6.exe : fatal error lnk1120: 8 unresolved externals ========== build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

ok, have included timxmlrpc.cpp , linked wininet.lib project. following...

1>------ build started: project: consoleapplication6, configuration: debug win32 ------ 1>  stdafx.cpp 1>  consoleapplication6.cpp 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(60): error c2011: 'xmlrpcexception' : 'class' type redefinition 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(60) : see declaration of 'xmlrpcexception' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75): error c2011: 'xmlrpcvalue' : 'class' type redefinition 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75) : see declaration of 'xmlrpcvalue' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(297): error c2011: 'xmlrpcclient' : 'class' type redefinition 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(297) : see declaration of 'xmlrpcclient' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(62): error c2027: use of undefined type 'xmlrpcvalue' 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75) : see declaration of 'xmlrpcvalue' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(108): error c2027: use of undefined type 'xmlrpcvalue' 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75) : see declaration of 'xmlrpcvalue' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(110): error c2065: '_allocated' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(121): error c2065: 'a' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(122): error c2065: 'a' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(122): error c2065: '_allocated' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(123): error c2065: '_allocated' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(125): error c2065: '_size' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(129): error c2027: use of undefined type 'xmlrpcvalue' 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75) : see declaration of 'xmlrpcvalue' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(129): error c2065: 'valuearray' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(129): error c2065: 'other' : undeclared identifier 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(130): error c2448: '==' : function-style initializer appears function definition 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(141): error c2027: use of undefined type 'xmlrpcvalue' 1>          c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.h(75) : see declaration of 'xmlrpcvalue' 1>c:\users\joe\documents\visual studio 2012\projects\consoleapplication6\consoleapplication6\timxmlrpc.cpp(141): fatal error c1903: unable recover previous error(s); stopping compilation ========== build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

is there xmlprcclient .lib file on machine somewhere?

if so, need add .lib linker settings, under linker | input | additional dependencies in project settings.

if not, need 1 somewhere. there discussion xmlrpc here

and manual:

don’t forget download , include timxmlrpc.h, timxmlrpc.cpp. also, remember add wininet.lib cpp client project

if have timxmlrpc.cpp file must include in project too.


Comments