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
➜ SWRiP: Compiling using Cygwin (Undefined reference problem)
|
SWRiP: Compiling using Cygwin (Undefined reference problem)
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Thu 05 Jan 2006 11:43 PM (UTC) Amended on Sat 07 Jan 2006 09:46 AM (UTC) by Nekekami
|
| Message
| Hello list,
I have been attempting to get SWRiP to compile within Cygwin for the last couple of hours. I get a problem that I have read up on but haven't found a solution to.
I would save you all excessive spam by pasting my make output, however it seems that for most standard functions (fprintf, calloc, perror, strcat, sprintf, etc) I get a 'Undefined reference to problem.
This sounds like its most probably a problem with the way in which my Cygwin is setup, however I am unsure how to solve this, or what needs to be modified.
My makefile:
Quote: CC = g++
PROF =
NOCRYPT =
#Uncomment the next line if you want MCCP support
#DBUGFLG = -DMCCP
C_FLAGS = $(OPT_FLAG) -O -g3 -Wall -Wuninitialized $(PROF) $(NOCRYPT) $(DBUGFLG) -DSMAUG $(SOLARIS_FLAG) $(TIME) $(REG) -DCYGWIN -Wno-trigraphs
L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK)
O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \
build.o clans.o comm.o comments.o const.o db.o fight.o \
handler.o hashstr.o id.o interp.o magic.o makeobjs.o \
misc.o mud_comm.o mud_prog.o krearena.o player.o requests.o \
reset.o save.o shops.o skills.o special.o tables.o task.o \
track.o update.o \
space.o space2.o bounty.o swskills.o alias.o grub.o mapper.o templateparse.o trivia.o
C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c boards.c \
build.c clans.c comm.c comments.c const.c db.c fight.c \
handler.c hashstr.c id.c interp.c magic.c makeobjs.c \
misc.c mud_comm.c mud_prog.c krearena.c player.c requests.c \
reset.c save.c shops.c skills.c special.c tables.c task.c \
track.c update.c \
space.c space2.c bounty.c swskills.c alias.c grub.c mapper.c templateparse.c trivia.c
H_FILES = mud.h bet.h
all:
# co $(H_FILES)
make swrip
# rm -f $(H_FILES)
mv swrip ../bin/swrip
swrip: $(O_FILES)
rm -f swrip
$(CC) $(L_FLAGS) -o swrip $(O_FILES) -lm
chmod g+w swrip
chmod g+w $(O_FILES)
.c.o: mud.h
$(CC) -c $(C_FLAGS) $<
clean:
rm -f $(O_FILES)
I downloaded Cygwin today and installed /all/ packages.
If you would like further information just drop me a reply.
Thanks,
-Nek | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #1 on Fri 06 Jan 2006 (UTC) Amended on Fri 06 Jan 2006 12:37 AM (UTC) by Zeno
|
| Message
| | Sounds like you're including the wrong header file, or missing an include for those functions. Could you paste some of the exact errors? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #2 on Fri 06 Jan 2006 10:40 AM (UTC) |
| Message
| Here is a copy of some of the errors I have been getting. I will include at the bottom a list of the Includes for each file.
Quote: //swskills.c:5941: undefined reference to `strcpy'
//swskills.c:5942: undefined reference to `stderr'
//swskills.c:5942: undefined reference to `fprintf'
//swskills.c:5942: undefined reference to `free'
//swskills.c:6018: undefined reference to `strcat'
swskills.o: In function `_Z13do_makemedpacP9char_dataPc':
//swskills.c:6119: undefined reference to `strcpy'
//swskills.c:6120: undefined reference to `stderr'
//swskills.c:6120: undefined reference to `fprintf'
//swskills.c:6167: undefined reference to `stderr'
swskills.o: In function `_Z16do_makefurnitureP9char_dataPc':
//swskills.c:6400: undefined reference to `strcpy'
//swskills.c:6402: undefined reference to `stderr'
//swskills.c:6402: undefined reference to `fprintf'
//swskills.c:6402: undefined reference to `free'
alias.o: In function `_Z8do_aliasP9char_dataPc':
/root/alias.c:76: undefined reference to `stderr'
/root/alias.c:76: undefined reference to `fprintf'
/root/alias.c:76: undefined reference to `free'
alias.o: In function `_Z12free_aliasesP9char_data':
/root/alias.c:115: undefined reference to `stderr'
/root/alias.c:115: undefined reference to `fprintf'
/root/alias.c:115: undefined reference to `free'
/root/alias.c:117: undefined reference to `stderr'
/root/alias.c:117: undefined reference to `fprintf'
/root/alias.c:117: undefined reference to `free'
/root/alias.c:118: undefined reference to `stderr'
/root/alias.c:118: undefined reference to `fprintf'
/root/alias.c:118: undefined reference to `free'
alias.o: In function `_Z11check_aliasP9char_dataPcS1_':
/root/alias.c:137: undefined reference to `sprintf'
/root/alias.c:165: undefined reference to `strcat'
/root/alias.c:166: undefined reference to `strcat'
grub.o: In function `_Z8do_rgrubP9char_dataPc':
//grub.c:136: undefined reference to `atoi'
//grub.c:139: undefined reference to `atoi'
//grub.c:140: undefined reference to `atoi'
//grub.c:155: undefined reference to `qsort'
grub.o: In function `_Z7go_initv':
//grub.c:196: undefined reference to `strcpy'
//grub.c:197: undefined reference to `strcpy'
//grub.c:198: undefined reference to `strcpy'
//grub.c:199: undefined reference to `strcpy'
//grub.c:200: undefined reference to `strcpy'
:: Swskills.c
#include <math.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mud.h"
:: Alias.c
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#include "mud.h"
:: Grub.c
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mud.h"
Do you want any more information? Also, I have cut down the repetition of errors in the above so make this post able.
-Nek | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Fri 06 Jan 2006 08:52 PM (UTC) |
| Message
| For a start, these are link errors, not compile errors. See this test program:
int blah ();
int main ()
{
blah ();
return 0;
}
Note the attempt to call "blah" which is defined but there is no code for it.
If we compile that:
$ gcc test.c
/tmp/ccsANsIj.o(.text+0x11): In function `main':
: undefined reference to `blah'
collect2: ld returned 1 exit status
That is your error message. It cannot link to the functions in your error list. Now there are a couple of funny things in your error log:
//swskills.c
Why does the filename have // in it? That looks strange.
/root/alias.c
Why are files in the root directory? This looks odd. I would expect you to have a home directory and the files be in that.
Assuming you installed as Nekekami I would expect something like:
/home/Nekekami/SWRiP/src/swskills.c
Did you unzip with folder names? There is something strange about the directory structure you are using.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #4 on Fri 06 Jan 2006 09:51 PM (UTC) |
| Message
| I just checked the layout of the files, they are all stored within the src directory which is contained at: /cygdrive/d/toc/swtoc/src
Thats the address within Cygwin, they are actually stored in D:\ToC\swtoc\src\
I am at a loss as to what is going on here, but I do agree, its strange that its //swskills.c and why its but root in front of alias... I am not sure.
-Nek | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Fri 06 Jan 2006 10:19 PM (UTC) |
| Message
| I would untar them inside Cygwin, and in your personal directory. Thus it should be something like:
/cygdrive/d/home/Nekekami/swtoc/src
In other words, in the Cygwin shell, type "cd" to go to your home directory, and untar the archive there. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #6 on Fri 06 Jan 2006 10:35 PM (UTC) |
| Message
| Well, I found my home directory and copied the files across to there. Then ran make again. Same set of errors again, with this at the bottom:
Quote: ollow
collect2: ld returned 1 exit status
make[1]: *** [swrip] Error 1
make[1]: Leaving directory `/home/Nunya Bizness/swtoc/src'
make: *** [all] Error 2
| | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #7 on Fri 06 Jan 2006 10:57 PM (UTC) |
| Message
| | Check if you can compile a normal codebase like SmaugFUSS. If not, something is wrong with your Cygwin. If you can, something is wrong with that SWRiP source. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #8 on Fri 06 Jan 2006 11:20 PM (UTC) |
| Message
| Ok, it compiles SWR FUSS absolutely fine. Any idea what is going on here? Or any further information i can provide?
-Nek | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #9 on Fri 06 Jan 2006 11:24 PM (UTC) |
| Message
| Try replacing the Makefile with the one from SWR FUSS maybe? I find this line a little odd:
C_FILES = $(wildcard *.c)
|
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #10 on Fri 06 Jan 2006 11:28 PM (UTC) Amended on Fri 06 Jan 2006 11:44 PM (UTC) by Nekekami
|
| Message
| Heh, i was one step ahead, just used the SWR Fuss makefile and I've got some progress:
mud.h:1295: warning: shadowed declaration is here
act_comm.c: In function `add_follower':
act_comm.c:2459: error: dereferencing pointer to incomplete type
act_comm.c:2465: error: dereferencing pointer to incomplete type
act_comm.c:2466: error: dereferencing pointer to incomplete type
act_comm.c:2467: error: dereferencing pointer to incomplete type
act_comm.c:2467: error: dereferencing pointer to incomplete type
act_comm.c:2467: error: dereferencing pointer to incomplete type
act_comm.c:2467: error: dereferencing pointer to incomplete type
act_comm.c:2467: error: dereferencing pointer to incomplete type
act_comm.c:2468: error: dereferencing pointer to incomplete type
act_comm.c: At top level:
act_comm.c:2480: warning: declaration of 'ch' shadows a global de
mud.h:1295: warning: shadowed declaration is here
act_comm.c: In function `stop_follower':
act_comm.c:2482: error: dereferencing pointer to incomplete type
act_comm.c:2488: error: dereferencing pointer to incomplete type
act_comm.c:2488: error: dereferencing pointer to incomplete type
act_comm.c:2488: error: dereferencing pointer to incomplete type
act_comm.c:2488: error: dereferencing pointer to incomplete type
act_comm.c:2488: error: dereferencing pointer to incomplete type
act_comm.c:2489: error: dereferencing pointer to incomplete type
act_comm.c:2491: error: dereferencing pointer to incomplete type
act_comm.c:2493: error: dereferencing pointer to incomplete type
act_comm.c:2497: error: dereferencing pointer to incomplete type
act_comm.c:2498: error: dereferencing pointer to incomplete type
act_comm.c:2499: error: dereferencing pointer to incomplete type
act_comm.c:2501: error: dereferencing pointer to incomplete type
act_comm.c:2502: error: dereferencing pointer to incomplete type
These are my latest batch of errors. What im not understanding here is that this code compiled perfectly on the unix box it was on before i moved it into cygwin...
-Nek | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #11 on Fri 06 Jan 2006 11:42 PM (UTC) Amended on Fri 06 Jan 2006 11:45 PM (UTC) by Zeno
|
| Message
| Could you edit that to use the code tag and not quote? It's very hard to read.
[EDIT] What's around lines 1295 in mud.h? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nekekami
United Kingdom (10 posts) Bio
|
| Date
| Reply #12 on Fri 06 Jan 2006 11:48 PM (UTC) |
| Message
| This is bizarre. Line 1295 is the CHAR_DATA *ch part of the below. It belongs to the ship_data structure...
int maxcargo;
sh_int caughtsmugcargo;
CHAR_DATA *ch;
SPACE_DATA *inorbitof;
int count;
MODULE_DATA *first_module;
-Nek | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #13 on Fri 06 Jan 2006 11:53 PM (UTC) Amended on Sat 07 Jan 2006 03:33 AM (UTC) by Zeno
|
| Message
| |
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #14 on Sat 07 Jan 2006 03:22 AM (UTC) |
| Message
| | Could you tell us where you downloaded this source from? The only SWRiP packages I can find don't have the same Makfile you do. | | 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.
75,149 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top