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)'" List-Archive: http://lists.mysql.com/plusplus/7802 Message-Id: <4888D693.3040007@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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.