List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 24 2008 7:22pm
Subject:Re: "undefined reference to `mysqlpp::Connection::connect(char const*,
char const*, char const*, char const*, unsigned int)'"
View as plain text  
Alex wrote:
>> 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;

Move the -l flags and mysql_config commands to the end of the command 
line.  POSIX linkers look at the command line right-to-left: the 
rightmost object should depend on nothing else, the next to rightmost 
should depend on either nothing, or only on what is in the rightmost 
object, etc.  The leftmost objects should be those that depend on 
everything to the right.  Since there's nothing to the right of your 
program modules, the linker doesn't see anything it can link 
AWIWorldServer to.  (Except for default libraries like libc, that is, 
which is always to the right of everything else.)

Your library order is otherwise correct: least generic on the left, most 
generic on the right.

Also, you should only be giving one of --libs or --libs_r to mysql_config.
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