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 ➜ SMAUG ➜ SMAUG coding ➜ Undefined reference help

Undefined reference help

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


Posted by Mozzy   (19 posts)  Bio
Date Mon 20 Oct 2003 09:03 PM (UTC)
Message
Hey everyone again,

I worked out that other stuff, and got it down - which is cool. ^.^ Thanks for the help. I have run into a new problem though. I just patched a global_boards patch onto the MUD, and did the necessary changes the MUD said. Though when I did, I get error messages like;

comm.o(.text+0x5d43): In function 'nanny':
/smaug/dist/src/comm.c:2474: undefined reference to '_handle_con_note_to'
comm.o(.text+0x5d49): In function 'nanny':
/smaug/dist/src/comm.c:2478: undefined reference to '_handle_con_note_subject'

etc. It continues, having undefined refernece errors with '_handle_con_expire_', '_handle_con_text', '_handle_con_finish.

So yeah.. Basically, I wana know - what does undefined reference mean? I have defined all the commands (I am pretty sure) in MUD.h as well as in Tables.C and everything. Any clues?

Thanks again
- Mozz
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 20 Oct 2003 09:50 PM (UTC)
Message
That means that your linker is not actually finding the function definition for the function in question.

This usually happens if, for example, you have:

[code]
extern int i;

int main()
{
printf("%d", i);
return 0;
}
[/code]

On its own, this will create an undefined reference error, because the compiler will not know where "i" is stored. However, since it's declared as an extern, the compiler will not produce a syntax/language error.

If you had to add a .c file with new functions in it, make sure you add it to your makefile.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #2 on Mon 20 Oct 2003 11:34 PM (UTC)

Amended on Tue 21 Oct 2003 05:14 AM (UTC) by Greven

Message
I would say that since they have _con_ in the errors, it means that you may have missed adding the connection states to the list in mud.h . These states are used by nanny to decide what to display, normal game text, log in stuff, or, in your case, the note console. Look into that, hope it helps. 'Course I can't see your code, so I can't be certain.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #3 on Tue 21 Oct 2003 07:12 AM (UTC)
Message
Hmm.. How do I add the new .c file to the makefile? I did add a new C file in there - I just assumed that the 'make' command just incorporated it automatically. So yeah, how do I do it?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Tue 21 Oct 2003 07:56 AM (UTC)
Message
Use vi on 'makefile' in your src directory. You should see a list of .o files and .c files - or something like that. Actually it should be fairly clear where you need to add it... just stick it in the list. If you still have doubts just paste the first part of your makefile and I'll tell you from there. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #5 on Tue 21 Oct 2003 08:51 AM (UTC)
Message
Woah.. You just got me mega confused.. use vi? What the? -_-

- Mozzy
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #6 on Tue 21 Oct 2003 08:58 AM (UTC)
Message
Okay, I did the 'vi makefile' in the src dir, and got something like;

CC = gcc
#PROF = -p
NOCRYPT =

#Uncomment the two lines beloe if compiling on a Solaris box
#SOLARIS_FLAG = -Dsun -DSYSV


And it goes on like that, finishing at


#Uncomment the line below if you want a performance increase tough beware "makefile" 73 lines, 2748 characters

So yeah, is that right? Also - how do I copy and paste outa Cygwin?

- Mozz
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Tue 21 Oct 2003 05:39 PM (UTC)
Message
Ohhh ok, you're using Cygwin. Then use your normal text editor or whatever you use to open up the source files. 'vi' is a very common/popular text editor on Unix-based systems.

You want to look for something like:
[code]
O_FILES = act_comm.o act_info.o act_obj.o \
a whole bunch of .o files
[/code]

Find that, that's where you stick in (your .c file).o according to the format shown in the file. Basically take off .c and put on .o instead.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #8 on Tue 21 Oct 2003 08:58 PM (UTC)

Amended on Tue 21 Oct 2003 09:07 PM (UTC) by Mozzy

Message
I use Microsoft Visual C++ to open the src files and edit them etc. Okay, what i did was do a big word find and found the appropiate file. (Makefile.Unix), and found all the .o's and .c files, as well as the .h files. What I did was, add in board.o, board.c and board.h (as there was one). Yet, I compile with Cygwin and it still doesn't recognis it. Whats the deal..?

- Mozz
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #9 on Tue 21 Oct 2003 09:28 PM (UTC)
Message
Please paste the contents of your makefile, otherwise it's impossible to tell what went wrong. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #10 on Wed 22 Oct 2003 04:56 AM (UTC)
Message
Woot woot! Got it down. All I gota do now is put in the commands for global_boards and such. Thanks a bunch everyone, you helped me out big time. ^_^

- Mozz
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.


29,758 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.