Odd Compiling Errors

Posted by IAmSlime on Tue 21 Mar 2006 01:23 AM — 3 posts, 13,488 views.

USA #0
Hello, this is sort of a continuation of my Help With ScratchMUD topic, that seems to have gone defunct. I am currently using a linux box running OpenSuSe 10.0, and with it I have been able to surpass my little progress with Windows. This is the Compile Log;

asmodean@linux:~/Desktop/ScratchMUD> make
g++ -c -Wall -O -ggdb src/avatar.cpp -o obj/avatar.o
g++ -c -Wall -O -ggdb src/colorTable.cpp -o obj/colorTable.o
g++ -c -Wall -O -ggdb src/commands.cpp -o obj/commands.o
g++ -c -Wall -O -ggdb src/commandTable.cpp -o obj/commandTable.o
g++ -c -Wall -O -ggdb src/editHandlers.cpp -o obj/editHandlers.o
g++ -c -Wall -O -ggdb src/loginHandlers.cpp -o obj/loginHandlers.o
g++ -c -Wall -O -ggdb src/main.cpp -o obj/main.o
g++ -c -Wall -O -ggdb src/smysql.cpp -o obj/smysql.o
g++ -c -Wall -O -ggdb src/socket.cpp -o obj/socket.o
g++ -c -Wall -O -ggdb src/split.cpp -o obj/split.o
src/split.cpp: In function âstd::string quotesSplit(const std::string&, std::string&)â:
src/split.cpp:93: warning: control reaches end of non-void function
g++ -c -Wall -O -ggdb src/stringutil.cpp -o obj/stringutil.o
g++ -c -Wall -O -ggdb src/timer.cpp -o obj/timer.o
g++ -c -Wall -O -ggdb src/timestamp.cpp -o obj/timestamp.o
g++ -c -Wall -O -ggdb src/world.cpp -o obj/world.o
rm -f scratch
g++ -o scratch obj/avatar.o obj/colorTable.o obj/commands.o obj/commandTable.o obj/editHandlers.o obj/loginHandlers.o obj/main.o obj/smysql.o obj/socket.o obj/split.o obj/stringutil.o obj/timer.o obj/timestamp.o obj/world.o -lmysqlclient -lcrypt
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [all] Error 1
asmodean@linux:~/Desktop/ScratchMUD>
USA #1
The above tells me that the error is on line 93 of Split.CPP, which is;

///////////////////////////////////////////////////////////
///////////////// Have an itch? Scratch it! ///////////////
///////////////////////// SCRATCH /////////////////////////
///////////////////// A MUD Server ////////////////////
///////////////////// By: Jared Devall ////////////////////
///////////////////// Thanks: ////////////////////
///////////////////// DIKU/Merc/ROM ////////////////////
///////////////////// Aetas/Deus Gang ////////////////////
///////////////////// Beej ////////////////////
///////////////////////////////////////////////////////////

#include "split.h"
#include <string>

using namespace std;

//////////////
// Get Word //
//////////////
string::const_iterator getword ( const string &src, string &dest, const char delim ) {
return getword( src.begin(), src.end(), dest, delim );
}

string::const_iterator getword ( string::const_iterator it, string::const_iterator end, string &dest, const char delim ) {
for ( ; it != end; ++it ) {
if ( *it == delim ) {
++it;
break;
}
dest += *it;
}
return it;
}

/////////////////
// Split Delim //
/////////////////
vector< string > split( const string &src, char delim ) {
vector<string> dest;
string current;

for ( string::const_iterator c = src.begin(); c != src.end(); ++c ) {
if ( (*c) == delim ) {
if ( (*c) == delim ) {
dest.push_back( current );
current = "";
continue;
} else {
current.push_back( (*c) );
}
}

if ( !current.empty() )
dest.push_back( current );

return dest;
}

string::const_iterator split( const string &src, string &word1, char delim ) {
return getword( src, word1, delim );
}
string::const_iterator split( const string &src, string &word1, string &word2, char delim ) {
return getword( getword( src, word1, delim ), src.end(), word2, delim );
}
string::const_iterator split( const string &src, string &word1, string &word2, string &word3, char delim ) {
return getword( getword( getword(src, word1, delim ), src.end(), word2, delim ), src.end(), word3, delim );
}
string::const_iterator split( const string &src, string &word1, string &word2, string &word3, string &word4, char delim ) {
return getword( getword( getword( getword( src, word1, delim ), src.end(), word2, delim ), src.end(), word3, delim ), src.end(), word4, delim );
}

///////////
// Split //
///////////
string::const_iterator split( const string &src, string &word1 ) {
return getword( src, word1, '\0' );
}
string::const_iterator split( const string &src, string &word1, string &word2 ) {
return getword( getword( src, word1 ), src.end(), word2, '\0' );
}
string::const_iterator split( const string &src, string &word1, string &word2, string &word3 ) {
return getword( getword( getword( src, word1 ), src.end(), word2 ), src.end(), word3, '\0' );
}
string::const_iterator split ( const string &src, string &word1, string &word2, string &word3, string &word4 ) {
}
string::const_iterator split ( const string &src, string &word1, string &word2, string &word3, string &word4 ) {
return getword( getword( getword( getword( src, word1 ), src.end(), word2 ), src.end(), word3 ), src.end(), word4, '\0' );
}


string quotesSplit( const string &src, string &dest ) {
string::const_iterator it;

for ( it = src.begin(); it != src.end(); ++it ) {
}
} // Line 93
USA #2
Please, please use code tags when posting code. It makes it easier to read which in turn makes people who read it to help you happier. :-)

First: line 93 isn't an error, it's a warning. It says that control reaches the end of a non-void function. That means that the function is supposed to return something (a string in this case), but you didn't return anything.

Second: your error is:
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: cannot find -lmysqlclient

This is saying that the linker is not finding the mysqlclient library. Have you installed it? Were there any instructions for the MUD that describe how to get things ready?