List:MySQL++« Previous MessageNext Message »
From:Alex Date:July 24 2008 1:33pm
Subject:"undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"
View as plain text  
My code:


> // Database stuffs.
> mysqlpp::Connection awi_mysql_conn(false);
> // Vars for the command line.
> TCLAP::ValueArg<char*> awi_tclap_mysql_pwd("p","mysql_pwd","MySQL
> Password",true,"admin","string");
> TCLAP::ValueArg<char*> awi_tclap_mysql_usr("u","mysql_usr","MySQL
> User",true,"root","string");
> TCLAP::ValueArg<char*> awi_tclap_mysql_db("d","mysql_db","MySQL
> Database",true,"awi","string");
> TCLAP::ValueArg<char*> awi_tclap_mysql_srv("s","mysql_srv","MySQL
> Server",true,"locahost","string");
> TCLAP::SwitchArg awi_tclap_open_mode("o","open_mode","Use Open
> Mode",false);
> // Stuffs for the system command line. Not the internal CLI.
> TCLAP::CmdLine awi_cmd("Artifitical World Intelligence",'
> ',awi_version,true);
> // Send the arguments to TCLAP.
> awi_cmd.add(awi_tclap_mysql_pwd);
> awi_cmd.add(awi_tclap_mysql_usr);
> awi_cmd.add(awi_tclap_mysql_db);
> awi_cmd.add(awi_tclap_mysql_srv);
> awi_cmd.add(awi_tclap_open_mode);
> // Parse the command line.
> awi_cmd.parse(argc,argv);
> // Get values.
> char* awi_mysql_db = awi_tclap_mysql_db.getValue();
> char* awi_mysql_srv = awi_tclap_mysql_srv.getValue();
> char* awi_mysql_usr = awi_tclap_mysql_usr.getValue();
> char* awi_mysql_pwd = awi_tclap_mysql_pwd.getValue();
> bool awi_open_mode = awi_tclap_open_mode.getValue();
> // Connect to the database using command line values.
>
> if(awi_mysql_conn.connect(awi_mysql_db,awi_mysql_srv,awi_mysql_usr,awi_mysql_pwd)){
>         std::cout << "Database connection successful." << endl;
> }else{
>         std::cout << "ERROR: Unable to connect to database." << endl;
>         exit(EXIT_FAILURE);
> };
>

The error:


> Main.cpp:(.text+0x16e9): undefined reference to
> `mysqlpp::Connection::connect(char const*, char const*, char const*, char
> const*, unsigned int)'


Does anyone have just the slightest idea what I'm doing wrong? My compiler
command is:


> g++ \
> -I./lib/MySQLPP -I./lib/TCLAP -I./lib/Miscellaneous \
> `mysql_config --cflags` `mysql_config --libs` `mysql_config --libs_r` \
> -lmysqlpp -lpthread -lnsl -lresolv \
> ./src/Main.cpp -o ./bin/AWIWorldServer;
>

To me this seems all good.. Any ideas?

Thanks.

Thread
"undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex24 Jul
  • Re: "undefined reference to `mysqlpp::Connection::connect(char const*,char const*, char const*, char const*, unsigned int)'"Warren Young24 Jul
    • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex25 Jul
      • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young26 Jul
Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young26 Jul
Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex27 Jul
  • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young27 Jul
Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex27 Jul
  • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young28 Jul
    • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex28 Jul
      • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young28 Jul
        • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex28 Jul
          • Re: "undefined reference to `mysqlpp::Connection::connect(char const*,char const*, char const*, char const*, unsigned int)'"Warren Young28 Jul
            • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex29 Jul
              • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young29 Jul
                • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex29 Jul
                  • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Warren Young29 Jul
                    • Re: "undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'"Alex29 Jul