Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUDs
➜ General
➜ Compiling tinymudserver in Windows
Compiling tinymudserver in Windows
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Sat 09 Sep 2006 01:06 AM (UTC) |
Message
| ie newbie
I have downloaded and installed cygwin, but I'm not sure what I do with it other than install it. Also, what is the best compiler to use for this? I'm using MSVC.NET, but maybe that's not the best for this. |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 09 Sep 2006 01:49 AM (UTC) Amended on Sat 09 Sep 2006 01:50 AM (UTC) by Nick Gammon
|
Message
| Make sure you have installed the development tools. That is, typing:
gcc --version
... should show something like:
$ gcc --version
gcc (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
rather than an error message.
You need to start up the "bash shell" that gets installed when you install cygin.
Now copy the tinymudserver_v2.tgz file into your "home" directory one way or another, and then from the bash shell unpack it:
tar xvzf tinymudserver_v2.tgz
That should create a directory "tinymudserver" with various files in it. Change to that directory:
cd tinymudserver
Then compile by typing "make:
make
That should create an executable.
I just tested it. That works, except because of tighter compiler rules I found I had to remove a semicolon from the end of lines 146, 208, 259, and 265. If you get an error you better edit the file tinymudserver.cpp and fix those lines up:
$ diff tinymudserver.cpp ../../tinymudserver/tinymudserver.cpp
146c146
< }; // end of FindAndReplace
---
> } // end of FindAndReplace
208c208
< };
---
> }
259c259
< void operator() (const T* ptr) const { delete ptr; };
---
> void operator() (const T* ptr) const { delete ptr; }
260a261
>
265c266
< void operator() (const T item) const { delete item.second; };
---
> void operator() (const T item) const { delete item.second; }
Fixed lines in bold.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #2 on Sun 10 Sep 2006 02:47 AM (UTC) |
Message
| For some reason gcc didn't install the first time. I did reinstall cygwin and gcc is now in there. My gcc --version looks identical to yours now.
make still does not work... just "command not found". |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 10 Sep 2006 02:59 AM (UTC) |
Message
| Better install "make" then - that is one of the options under developer tools. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #4 on Tue 12 Sep 2006 05:15 AM (UTC) |
Message
|
Quote: $ diff tinymudserver.cpp ../../tinymudserver/tinymudserver.cpp
146c146
< }; // end of FindAndReplace
---
> } // end of FindAndReplace
208c208
< };
---
> }
259c259
< void operator() (const T* ptr) const { delete ptr; };
---
> void operator() (const T* ptr) const { delete ptr; }
260a261
>
265c266
< void operator() (const T item) const { delete item.second; };
---
> void operator() (const T item) const { delete item.second; }
I seem to have completely different line numbers (using a win text editor)-- I think I removed the right semi-colons, but I still get errors. Just to be sure, where exactly is 208c208? |
Artel. | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #5 on Tue 12 Sep 2006 06:03 AM (UTC) |
Message
| I think that 208c208 means that it's line 208 of the 'left' file compared with line 208 of the 'right' file. Basically it's complaining about there being semi-colons after function definitions. The gcc suite is getting rather good at enforcing language standards, which might seem annoying but is actually a good thing because it forces people to write cleaner code. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 12 Sep 2006 06:37 AM (UTC) |
Message
| The line numbers should not be completely different, unless you are using a different version or something.
However you should only see one place in the source with:
// end of FindAndReplace
in it. If there is a semicolon after the } at the start of that line, that is the one to get rid of.
The place in your file should be roughly where the error message line points to. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #7 on Tue 12 Sep 2006 09:34 PM (UTC) |
Message
| For some reason, when I open it in Notepad++, it doublespaces the lines which causes the odd line numbers, but I guess that makes then approximately double yours. Could the double spaces be causing errors?
When I try to make after fixing those semi-colons, I get a few errors ...
> make
g++ -g3 -Wall -w -pedantic -c tinymudserver.cpp
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `,' or `;' before '&' token
tinymudserver.cpp: In member function `tPlayer& tPlayer::operator<<(const T&)':
tinymudserver.cpp:411: error: expected primary-expression before ';' token
tinymudserver.cpp: In function `tRoom* FindRoom(const int&)':
tinymudserver.cpp:757: error: no matching function for call to `std::runtime_err
or::runtime_error()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:109: note: candidates ar
e: std::runtime_error::runtime_error(const std::runtime_error&)
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:115: note: std::runtime
_error::runtime_error(const std::string&)
tinymudserver.cpp: In member function `tPlayer* tPlayer::GetPlayer(std::istream&
, const std::string&, const bool&)':
tinymudserver.cpp:839: error: no matching function for call to `std::runtime_err
or::runtime_error()'
tinymudserver.cpp:781: note: candidates are: std::runtime_error::runtime_error(c
onst std::runtime_error&)
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:115: note: std::runtime
_error::runtime_error(const std::string&)
tinymudserver.cpp: In function `void bailout(int)':
tinymudserver.cpp:861: error: `bStopNow' undeclared (first use this function)
tinymudserver.cpp:861: error: (Each undeclared identifier is reported only once
for each function it appears in.)
tinymudserver.cpp: In function `void DoShutdown(tPlayer*, std::istream&)':
tinymudserver.cpp:1787: error: `bStopNow' undeclared (first use this function)
tinymudserver.cpp: In function `void DoGoTo(tPlayer*, std::istream&)':
tinymudserver.cpp:1835: error: expected primary-expression before ',' token
tinymudserver.cpp: In function `void MainLoop()':
tinymudserver.cpp:2637: error: `bStopNow' undeclared (first use this function)
make: *** [tinymudserver.o] Error 1
I wanted to verify where exactly 208c208 was to make sure I didn't remove the wrong semi-colon...and a line of }; isn't exactly the rarest thing to find. Also, what did 260a261 indicate? |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #8 on Wed 13 Sep 2006 (UTC) Amended on Wed 13 Sep 2006 12:01 AM (UTC) by Nick Gammon
|
Message
| Try Crimson Editor:
http://www.crimsoneditor.com/
That is freeware, and doesn't seem to have that problem.
Or, use vi in the bash shell.
Yes, adding extra lines might throw out compilation under certain circumstances.
// string find-and-replace
string FindAndReplace
(const string& source, const string target, const string replacement)
{
string str = source;
string::size_type pos = 0, // where we are now
found; // where the found data is
if (target.size () > 0) // searching for nothing will cause a loop
while ((found = str.find (target, pos)) != string::npos)
{
str.replace (found, target.size (), replacement);
pos = found + replacement.size ();
}
return str;
}; // end of FindAndReplace <-- line 146
// output to player (any type)
template<typename T>
tPlayer & operator<< (const T & i)
{
outbuf += MAKE_STRING (i);
return *this;
}; <-- line 208
// see Josuttis p12 and Meyers p38
struct DeleteObject
{
template <typename T>
void operator() (const T* ptr) const { delete ptr; }; <-- line 259
};
// similar concept for maps
struct DeleteMapObject
{
template <typename T>
void operator() (const T item) const { delete item.second; }; <-- line 265
};
I must have added a blank line which is why 265 became 266. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #9 on Wed 13 Sep 2006 12:32 AM (UTC) |
Message
| All right, this time I deleted the directory, reunpacked the file, and removed those semi-colons using Crimson Editor. There's no extra new lines now. I'm still getting several errors though:
> make
g++ -g3 -Wall -w -pedantic -c tinymudserver.cpp
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `)' before '&' token
tinymudserver.cpp:135: error: expected `,' or `;' before '&' token
tinymudserver.cpp: In member function `tPlayer& tPlayer::operator<<(const T&)':
tinymudserver.cpp:411: error: expected primary-expression before ';' token
tinymudserver.cpp: At global scope:
tinymudserver.cpp:516: error: extra semicolon
tinymudserver.cpp:527: error: extra semicolon
tinymudserver.cpp:534: error: `string' does not name a type
tinymudserver.cpp: In function `tRoom* FindRoom(const int&)':
tinymudserver.cpp:754: error: no matching function for call to `std::runtime_err
or::runtime_error()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:109: note: candidates ar
e: std::runtime_error::runtime_error(const std::runtime_error&)
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:115: note: std::runtime
_error::runtime_error(const std::string&)
tinymudserver.cpp: In member function `tPlayer* tPlayer::GetPlayer(std::istream&
, const std::string&, const bool&)':
tinymudserver.cpp:836: error: no matching function for call to `std::runtime_err
or::runtime_error()'
tinymudserver.cpp:778: note: candidates are: std::runtime_error::runtime_error(c
onst std::runtime_error&)
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/stdexcept:115: note: std::runtime
_error::runtime_error(const std::string&)
tinymudserver.cpp: In function `void bailout(int)':
tinymudserver.cpp:858: error: `bStopNow' undeclared (first use this function)
tinymudserver.cpp:858: error: (Each undeclared identifier is reported only once
for each function it appears in.)
tinymudserver.cpp: In function `void DoShutdown(tPlayer*, std::istream&)':
tinymudserver.cpp:1784: error: `bStopNow' undeclared (first use this function)
tinymudserver.cpp: In function `void DoGoTo(tPlayer*, std::istream&)':
tinymudserver.cpp:1832: error: expected primary-expression before ',' token
tinymudserver.cpp: In member function `void tPlayer::ProcessRead()':
tinymudserver.cpp:2304: error: `Trim' undeclared (first use this function)
tinymudserver.cpp: In function `void MainLoop()':
tinymudserver.cpp:2634: error: `bStopNow' undeclared (first use this function)
make: *** [tinymudserver.o] Error 1
Any ideas? |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #10 on Wed 13 Sep 2006 12:59 AM (UTC) |
Message
| I just downloaded that file again, and unzipped it and put it into my Cygwin directory. I typed "make" and got this:
$ make
g++ -g3 -Wall -w -pedantic -c tinymudserver.cpp
tinymudserver.cpp:146: error: extra `;'
tinymudserver.cpp:208: error: extra semicolon
tinymudserver.cpp:259: error: extra semicolon
tinymudserver.cpp:265: error: extra semicolon
make: *** [tinymudserver.o] Error 1
I love these error messages. What is the difference between "extra ';'" and "extra semicolon"?
I removed those 4 semicolons, and typed "make" again and got this:
$ make
g++ -g3 -Wall -w -pedantic -c tinymudserver.cpp
g++ -g3 -Wall -w -pedantic -o tinymudserver tinymudserver.o
$ ./tinymudserver
Tiny MUD server version 2.0.0
Accepting connections from port 4000
The file I used was:
http://www.gammon.com.au/files/muds/tinymudserver_v2.tgz
I can't explain your errors - did you use that file? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #11 on Wed 13 Sep 2006 02:29 AM (UTC) |
Message
| I didn't have the file in the cygwin directory at first. Everything is working now...thanks! |
Artel. | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #12 on Wed 13 Sep 2006 07:43 PM (UTC) |
Message
| Thought I should add this in case anyone tries this later on that when you try to compile tinymudserver_v2_2.tgz (the one with seperate source files) that in addition to removing those four semi-colons, you might need to add #include <sys/errno.h> to player.cpp and #include <fstream> to utils.h before it will compile under cygwin. |
Artel. | 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.
36,016 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top