Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUDs
➜ General
➜ Help With ScratchMUD
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
3
4
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Thu 12 Jan 2006 07:09 AM (UTC) |
Message
| Yeah, I know this isn't one of the 'supported' codebases out here, and yes I know I'm a total newbie who doesn't deserve to have his own MUD... Nonetheless, I would like to get this one working.
You can download a copy from: http://www.dragonssquare.com or, if you're too lazy you could go directly to: http://www.dragonssquare.com/scratch/download.php
Now, then.. It extracts just fine, though I'll post that ouput below as well just for reference;
scratch/
scratch/Makefile
scratch/README
scratch/obj/
scratch/src/
scratch/src/main.cpp
scratch/src/avatar.cpp
scratch/src/avatar.h
scratch/src/socket.h
scratch/src/socket.cpp
scratch/src/world.cpp
scratch/src/world.h
scratch/src/smysql.h
scratch/src/smysql.cpp
scratch/src/loginHandlers.cpp
scratch/src/handler.h
scratch/src/commands.h
scratch/src/commands.cpp
scratch/src/commandTable.cpp
scratch/src/commandTable.h
scratch/src/colorTable.cpp
scratch/src/colorTable.h
scratch/src/editHandlers.h
scratch/src/editHandlers.cpp
scratch/src/split.cpp
scratch/src/split.h
scratch/src/stringutil.cpp
scratch/src/stringutil.h
scratch/src/timer.cpp
scratch/src/timer.h
scratch/src/timestamp.cpp
scratch/src/timestamp.h
Ok, then... Looks fine, right? This is what happens when you 'MAKE' with Cygwin.
g++ -c -Wall -O -ggdb src/avatar.cpp -o obj/avatar.o
src/avatar.cpp:17:25: mysql/mysql.h: No such file or directory
In file included from src/avatar.cpp:18:
src/smysql.h:38: error: `std::vector<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > >, std::allocator<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > > > >' is not a template
src/avatar.cpp: In member function `std::string Avatar::EncryptPassword(const std::string&)':
src/avatar.cpp:179: error: `crypt' undeclared (first use this function)
src/avatar.cpp:179: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [obj/avatar.o] Error 1
^Not good.
And last, but not least.. The contents of the makefile are;
CC = g++
CFLAGS = -Wall -O -ggdb
LFLAGS = -lmysqlclient -lcrypt
SRCFILES := $(wildcard src/*.cpp)
OBJFILES := $(patsubst src/%.cpp,obj/%.o,$(SRCFILES))
all: $(OBJFILES)
rm -f scratch
$(CC) -o scratch $(OBJFILES) $(LFLAGS)
obj/%.o: src/%.cpp
$(CC) -c $(CFLAGS) $< -o $@
clean:
rm -f obj/*.o
rm -f scratch
Again, as with last post.. -ANY- information whatsoever is extremely appreciated.
-Slime Aspires To Be Zeno and/or Nick Gammon :P |
"Life Sucks, Then You Die." | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 12 Jan 2006 08:52 AM (UTC) |
Message
|
Quote:
mysql/mysql.h: No such file or directory
First thing, it looks like you need to install mySQL for it to work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #2 on Thu 12 Jan 2006 11:25 AM (UTC) |
Message
|
Quote: src/avatar.cpp:179: error: `crypt' undeclared (first use this function)
And then you need to install the crypt library if you don't have it and make sure any files reporting this error include crypt.h | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #3 on Thu 12 Jan 2006 11:25 AM (UTC) |
Message
| Adding the line:
at the top of your avatar.cpp file (with the other includes) should get rid of your crypt error.
As for MySQL, you need to install it. Head over to www.mysql.com and find the download (I would recommend the admin application unless you are very command line savvy).
Could you paste line 38 from smysql.h (and the general code around it)? |
~Nick Cash
http://www.nick-cash.com | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #4 on Fri 13 Jan 2006 01:18 AM (UTC) |
Message
| Nick: First thing, it looks like you need to install mySQL for it to work.
Well, before I posted here I went and grabbed a copy from the website www.mysql.com. I installed the program and then
tried re-making the files (after MAKE CLEAN, of course) but it still gave me the same error..
Samson: And then you need to install the crypt library if you don't have it and make sure any files reporting this error
include crypt.h
I'm pretty sure I have downloaded it sometime in the last month or so because some of the MUD servers I've worked
with in the last bit had the -lcrypt flag and seemed to work... Though I'm not sure how I could tell if I do, for sure, have
the library... Is there a specific file I could look for somewhere in the Cygwin directory?
And last, but not least;
Whiteknight:
Adding the line: #include <crypt.h> at the top of your avatar.cpp file (with the other includes) should get rid of your crypt error. As for MySQL, you need to install it. Head over to www.mysql.com and find the download (I would recommend the admin
application unless you are very command line savvy). Could you paste line 38 from smysql.h (and the general code around it)?
This is what happened -after- I added <crypt.h> to the file (also, is there a difference between "crypt.h" and <crypt.h>?)
g++ -c -Wall -O -ggdb src/avatar.cpp -o obj/avatar.o
src/avatar.cpp:17:25: mysql/mysql.h: No such file or directory
In file included from src/avatar.cpp:18:
src/smysql.h:38: error: `std::vector<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > >, std::allocator<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > > > >' is not a template
make: *** [obj/avatar.o] Error 1
And, here is the contents of Avatar.CPP (From the first non-comment line down to what I believe is the end of that line of code, which is line 49.)
#include <cstdarg>
#include <cstdio>
#include <fstream>
#include <map>
#include <mysql/mysql.h>
#include "smysql.h"
#include "avatar.h"
#include "colorTable.h"
#include <crypt.h> //Just Added
#include "stringutil.h"
#include "timestamp.h"
using namespace std;
Avatar::Avatar( ) {
_disconnected = false;
_socket = new Socket;
_gotInput = false;
_status = LOGIN;
}
// get rid of the socket when avatar is deleted
// disconnect and remove from list & delete
Avatar::~Avatar( ) {
if ( _socket ) {
if ( !_socket->GetSocketIP().empty() ) {
SocketServer::Instance()._socketList.remove( _socket );
SocketServer::Instance().KillSocket( _socket );
if ( Get( "name" ).empty() ) {
cout << _socket->GetSocketIP() << " has disconnected @ " << Timestamp::Instance().GetDateTime() << "\n\r";
} else {
cout << Get( "name" ) << " has disconnected @ " << Timestamp::Instance().GetDateTime() << "\n\r";
}
}
delete _socket;
}
}
Thanks for gettin' back in touch with me so quickly, and the answers you've given me thus far.. Look forward to hearing more from you all. |
"Life Sucks, Then You Die." | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #5 on Fri 13 Jan 2006 03:51 AM (UTC) |
Message
|
Quote:
src/avatar.cpp:17:25: mysql/mysql.h: No such file or directory
Well, there are more than one ways of installing mysql. It looks to me from this error that it expects mysql.h in a subdirectory. Is that file indeed there? You may have the mysql executables and not the source. You may not have even installed mysql.h, or if you have it may be in a different place.
I would fix that before worrying about the error message about:
src/smysql.h:38: error: `std::vector blah-de-blah-blah > > > >' is not a template
... because that refers to mysql. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #6 on Fri 13 Jan 2006 03:54 AM (UTC) |
Message
| Well, if I head back to www.mysql.com and download the source instead.. Where am I supposed to drop the files? A subdirectory in the SRC folder called MYSQL? I'm just asking because I have no idea where I should have this bloody thing installed.. I do have something from the www.mysql.com site installed to my program files..
Just wondering. |
"Life Sucks, Then You Die." | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 13 Jan 2006 04:05 AM (UTC) |
Message
| I'm not totally certain myself, I seem to recall a certain amount of pain being associated with getting the mysql source to work.
One approach would be to download and unzip the source, and then simply find mysql.h in the downloaded directory and put it where it is expected. However this may merely delay the problem, as it needs other files, libraries, etc.
Quote:
...I'm a total newbie who doesn't deserve to have his own MUD ...
This obviously isn't true. Anyone can "deserve" to have a MUD. Some are easier to set up than others. :)
If I may suggest, the SmaugFUSS codebase, available here and supported by Samson, doesn't require mysql and works "out of the box". Using mysql to store whatever-it-is that they store is adding another layer of complexity.
For MUD "newbies" it is probably easiest on yourself to find a codebase that works with minimal extra work. At least with SmaugFUSS I generally get it to compile and run without any fuss (no pun) on both Cygwin and Linux. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #8 on Fri 13 Jan 2006 04:08 AM (UTC) |
Message
| Well, I was hoping to go with Scratch because it comes free of all the stock areas and resets that tend to destroy the MUD when I fool around with it too much, though I am also already tinkering about with the SmaugFUSS from this site. Something I have been meanin' to drop in here and thank you for porting. Well, I guess I'll tinker with the MySQL a little more and if I still don't get it, I'll just have to wait until I get some more experience with coding and working with *nix systems.. Thanks, again. |
"Life Sucks, Then You Die." | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #9 on Sat 14 Jan 2006 08:49 PM (UTC) Amended on Sat 14 Jan 2006 09:14 PM (UTC) by IAmSlime
|
Message
| I managed to weasel the MySQL files into the compile well enough that it's no longer having issues with that. (I think.)
What I did was download the MySQL Source (as was suggested) and copied mysql.h into the SRC directory of this mud server. Then, in Avatar.CPP I changed #include <mysql/mysql.h> to #include "mysql.h". This managed to get me a horrendously long error log.. After reading through it to the top, I noticed it now wanted the following files;
my_alloc.h
my_list.h
mysql_com.h
mysql_time.h
mysql_version.h
typelib.h
After hunting those down in the source for MySQL, and dropping them into the SRC file of the server, I managed to get it down to 2 errors. One of which was smysql.h (came with server) was still linking to the #include <mysql/mysql.h>, so I changed it to #include "mysql.h" like I did in Avatar.cpp. Another make, and things seemed to being well, until this one kicked in;
g++ -c -Wall -O -ggdb src/avatar.cpp -o obj/avatar.o
In file included from src/avatar.cpp:18:
src/smysql.h:38: error: `std::vector<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > >, std::allocator<std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > > > >' is not a template
make: *** [obj/avatar.o] Error 1
So, using my lackluster coding experience, I've been able to figure out that it's in smysql.h on line 38. Since that header is so short, I'll post it here in its entirety.
///////////////////////////////////////////////////////////
///////////////// Have an itch? Scratch it! ///////////////
///////////////////////// SCRATCH /////////////////////////
///////////////////// A MUD Server ////////////////////
///////////////////// By: Jared Devall ////////////////////
///////////////////// Thanks: ////////////////////
///////////////////// DIKU/Merc/ROM ////////////////////
///////////////////// Aetas/Deus Gang ////////////////////
///////////////////// Beej ////////////////////
///////////////////////////////////////////////////////////
#ifndef __SMYSQL_H_
#define __SMYSQL_H_
#include <string>
#include <map>
#include <vector>
#include "mysql.h"
class Mysql {
public:
typedef struct st_mysql MYSQL;
typedef std::map< std::string, std::string > LMAP;
typedef std::vector< LMAP > RESULT;
private:
MYSQL * _dbinstance;
public:
Mysql ( const char * hostname, const char * username, const char * password, const char * dbname );
~Mysql( );
bool Query( const char * query );
int QueryRows( const char * query );
bool RealQuery( const char * query );
std::string EscapeString( const std::string & );
bool Load( const char * query );
RESULT< LMAP > _info;
static Mysql &Instance();
};
// Our singleton instance
inline Mysql &Mysql::Instance() {
static Mysql instance( "localhost", "rendelven", "rendelhaven", "rendelven" );;
return instance;
}
#endif // _SMYSQL_H
Alright, so... Look forward to any more help that can be provided.
-Edit: I just figured out the difference between "blah.h" and <blah.h> so I've moved the MySQL-related files into CygwinRoot/Usr/Include and changed the #Include links to reflect this... |
"Life Sucks, Then You Die." | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #10 on Wed 18 Jan 2006 05:18 AM (UTC) |
Message
| I'm still havin' issues with this particular error. I'm guessing there's been no replies because no one realizes thie thread is still active. I appreciated the help that has been given thus far, and I hope someone out there may have some more information that may lead to me slaying this proverbial dragon.
Thanks, Slime. |
"Life Sucks, Then You Die." | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #11 on Wed 18 Jan 2006 06:14 PM (UTC) |
Message
| I've gotten this to compile using Dev-C++ and it works fine. The error you are having is with this line:
RESULT< LMAP > _info;
Delete the < LMAP > portion. I do not know if this is how it should be, but it seems to work. The only downside is that you should really copy whatever the thing is holding after a query because it will later be modified and screw with your data. |
~Nick Cash
http://www.nick-cash.com | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #12 on Wed 18 Jan 2006 07:10 PM (UTC) |
Message
| Sorry for not replying sooner, I wasn't really keen to find and install the codebase, find and install mysql source, and then work out what the error was, when you might have had a different version of gcc.
Whiteknight is right, basically.
A test program illustrates the problem:
#include <vector>
void test ()
{
typedef int LMAP; // for testing
typedef std::vector< LMAP > RESULT;
RESULT< LMAP > _info;
}
$ gcc test.cpp
test.cpp: In function `void test()':
test.cpp:10: non-template type `RESULT' used as a template
test.cpp:10: ISO C++ forbids declaration of `_info' with no type
The extra <LMAP> is redundant here. This compiles OK:
#include <vector>
void test ()
{
typedef int LMAP; // for testing
typedef std::vector< LMAP > RESULT;
RESULT _info;
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| IAmSlime
USA (26 posts) Bio
|
Date
| Reply #13 on Thu 19 Jan 2006 12:35 AM (UTC) |
Message
| Wow, another success. It made it through the first four or five files without a hitch, then it ran into smysql.cpp and the horror began. I had a page-length and a half of errors, or so. So, I figured something out. If WhiteKnight downloaded the codebase, and it worked fine for him using Dev-CPP then I must be doin' something wrong (aside from using Cygwin, that is). So, seeing as I already have Dev-CPP I was hopin' perhaps WhiteKnight might be willing to give me some basic directions on how to actually compile properly with the program, because I'm always getting little issues with "this doesn't point to that" and "this file included by this file doesn't know what the hell that is" and all that fun stuff.... So.. Thank again for a large chunk of help, now I just need to use Dev-CPP it appears..
-Slime |
"Life Sucks, Then You Die." | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #14 on Thu 19 Jan 2006 06:02 PM (UTC) Amended on Thu 19 Jan 2006 06:03 PM (UTC) by Nick Cash
|
Message
| Just post your errors here. It shouldn't be hard to compile in Dev. Just make sure you downloaded a MySQL package and link in the mysql library (along with crypt (for my testing purposes i just modified it to not use crypt) and wsock32 ).
Also, make sure you define WIN32 so the preprocessor will make the correct changes.
Beyond that just change your connection info for your local mysql stuffs and you should be all set.
On another note, you will need to make a character and manually give yourself hte admin group. There is no way to do it in game.
The base, besides the minor defects, seems quite stable and easily expandible. |
~Nick Cash
http://www.nick-cash.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
103,464 views.
This is page 1, subject is 4 pages long: 1 2
3
4
It is now over 60 days since the last post. This thread is closed.
Refresh page
top