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
➜ SMAUG
➜ Compiling the server
➜ VC++ 6.0 Compiling LNK2001 error
|
VC++ 6.0 Compiling LNK2001 error
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Mike Scherling
USA (20 posts) Bio
|
| Date
| Mon 12 Jul 2004 09:48 PM (UTC) Amended on Mon 12 Jul 2004 09:54 PM (UTC) by Mike Scherling
|
| Message
| Linking...
Descriptor2.obj : error LNK2001: unresolved external symbol "void __cdecl status_update(class CCharacter *)" (?status_update@@YAXPAVCCharacter@@@Z)
.\Debug/SmaugWiz.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
SmaugWiz.exe - 2 error(s), 0 warning(s)
Working on a new status_update script on Smaug 1.4 that was ported to windows xp (everything runs fine through it) using SmaugWiz... Using a new system for things like.. if someone buffs your con stat (for instance) your life and defence woudl go up as well, all sat dependant.. and this script forces an update every time prompt is loaded...
Im having a problem with linking to the SMAUG.H file using a previous void status_update (CCharacter *ch); line
now...
This is the line I put into my SMAUG.H file
extern void status_update (CCharacter *ch);
question is, would this be all i need to do to link to my UPDATE.CPP file so it can be called upon by my Descriptor2.cpp file? Ive tried many different ways of using it, and searched through similar linkings to find how they did it, but i cant seem to find why i get the error as mentioned above.
Any help is appreciated, thanks! =) |
The source is all around us...
in the food you eat...
in the air you breath...
in your tooth... yes, your tooth...
any questions?
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 12 Jul 2004 10:07 PM (UTC) Amended on Mon 12 Jul 2004 10:10 PM (UTC) by Nick Gammon
|
| Message
| The line you have added:
extern void status_update (CCharacter *ch);
*declares* that you will, somewhere, have a status_update function.
However since you are getting a linker error you haven't *defined* what that does.
In other words, somewhere in your source (in a .c file) you need to have:
void status_update (CCharacter *ch)
{
// ... do something here
}
Also, this .c file need to compile successfully, and be linked into the link.
For example, the status_update routine either needs to be in an existing file, or you add the new file to your Makefile, like this:
O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \
build.o clans.o color.o comm.o comments.o const.o db.o deity.o fight.o \
handler.o hashstr.o ident.o interp.o magic.o makeobjs.o \
mapout.o misc.o mpxset.o mud_comm.o mud_prog.o player.o polymorph.o \
reset.o save.o shops.o skills.o special.o tables.o \
track.o update.o grub.o ban.o services.o planes.o \
imm_host.o status_update.o
C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c boards.c \
build.c clans.c color.c comm.c comments.c const.c db.c deity.c fight.c \
handler.c hashstr.c ident.c interp.c magic.c makeobjs.c \
mapout.c misc.c mpxset.c mud_comm.c mud_prog.c player.c polymorph.c \
reset.c save.c shops.c skills.c special.c tables.c \
track.c update.c grub.c ban.c services.c planes.c \
imm_host.c status_update.c
(edit)
I notice your post mentions an update.cpp file. That is presumably where the status_update routine is to go. This implies you are using C++ rather than C, but the rest of my comments stand. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Mike Scherling
USA (20 posts) Bio
|
| Date
| Reply #2 on Mon 12 Jul 2004 10:12 PM (UTC) Amended on Mon 12 Jul 2004 10:20 PM (UTC) by Mike Scherling
|
| Message
| Thanks for the much needed answer, and I realized what I had done...
I had 2 versions of this script (update_stats) and (status_update)..
what i had done was written out update_stats for my void (the one with all the info) and it wasnt finding my origional 100+ lines of code.. and to fix this, naturally, i renamed it, and now it works, =)
Thanks for the well spent tie in writing the post, it made me realize the error of my ways =)
EDIT: ugh, now this problem...
void status_update (CCharacter *ch)
{
ASSERT (ch);
if (! ch->IsNpc())
CClassData *pClass = ClassTable.GetClassData (ch->GetClass ());
{
int con = (int) ch->GetConstitution();
I am getting a critical error on an ASSERT: problem dealing with that line there... what exactly needs to be defined there for it to work correctly...
note - it wasnt a compiling error, it compiled clean, the error happened when i ran my .exe and loaded it up.. crashed upon loading
***
EDIT - AGAIN: Okay, i compiled again after seeing nothign wrong with the code.. and it works, loaded up playing correctly... AND, my script is working successfully, i origionall had it toied in with a Pulse check for mobiles, but that took too long (up to a minute for stats to update), now every time my prompt loads up, it activates the script.. WOOHOO, Buggy Windows XP sure has its quirks, eh? =) |
The source is all around us...
in the food you eat...
in the air you breath...
in your tooth... yes, your tooth...
any questions?
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 13 Jul 2004 04:25 AM (UTC) |
| Message
| The ASSERT looks OK, sounds like a bug that it was calling the routine with a null ch.
It is almost worth taking the assert out and letting it crash, then use the debugger to find where it was called from.
Alternatively, guard yourself like this:
if (ch == NULL)
{
// maybe log an error message
return;
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.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.
16,133 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top