Register forum user name Search FAQ

Gammon Forum

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 ➜ [SOLVED] Adding List to TinyMudServer Yields Linker Errors

[SOLVED] Adding List to TinyMudServer Yields Linker Errors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Arew264   (8 posts)  Bio
Date Sun 31 Dec 2006 03:38 AM (UTC)

Amended on Sun 31 Dec 2006 03:50 AM (UTC) by Arew264

Message
I have been trying to add a list to tinymudserver. It is a list of an object I have added called tArea, which is in its own area.h file. Also in area.h I have put in:

typedef std::list <tArea*> tAreaList;
typedef tAreaList::iterator tAreaListIterator;


To my understanding, this is defining the datatype tAreaList as a list of pointers to tArea objects, and defining an iterator for that list of pointers to tArea objects.
To create a global area list, I have added

#include "area.h"


to globals.h and then added the line:

extern tAreaList arealist;


to define the global area list. To my understanding this should create a global list of areas, yet when I try to use the area list, g++ compiles it fine but I get linker errors:

undefined reference to `_arealist'

These errors occur whenever I try to use the area list, but in case it matters I am including both globals.h and area.h and the first line of this code throws the error:

     for(tAreaListIterator iter = arealist.begin(); iter != arealist.end(); iter++)
     {
          (*iter)->LoadArea();
     }


There is probably something blaringly obvious that I am doing wrong here, but I can't see it and I am going nuts trying to figure this out.
Top

Posted by Arew264   (8 posts)  Bio
Date Reply #1 on Sun 31 Dec 2006 03:40 AM (UTC)
Message
Just realized I have a typo in the subject line, and something odd happened with the fonts in my post. Shame I can't edit it. Sorry to anyone that is bothered by it.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Sun 31 Dec 2006 03:44 AM (UTC)
Message
You should be able to edit your post title, and post.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Arew264   (8 posts)  Bio
Date Reply #3 on Sun 31 Dec 2006 03:50 AM (UTC)
Message
Well, I feel like an idiot. I'm guessing that line in globals.h serves as a "prototype"?

I added

tAreaList arealist;

to globals.cpp and the whole thing started working.

Thanks for putting great reference materials on here, what tipped me off was your implementation of classes in the Tinymudserver v2 topic.
Top

Posted by Arew264   (8 posts)  Bio
Date Reply #4 on Sun 31 Dec 2006 03:51 AM (UTC)
Message
Ah, I can't edit the subject but I fixed the font problem.

I'm used to logging in when I post and the system keeping me logged in.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Sun 31 Dec 2006 03:58 AM (UTC)
Message
There should be a "Amend subject description" link to do that.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
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.


16,161 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.