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 ➜ ROM ➜ Compiling the server ➜ Help me? Pretty please?

Help me? Pretty please?

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


Posted by Demitrus   (3 posts)  Bio
Date Mon 24 Apr 2006 09:21 PM (UTC)
Message
Alright, this becoming a rather large headache, and I get the same exact error for all the codebases I have tried to compile - From Dawn, to Rom24b6, To startermud, afkmud, basically every rom deritive in existance. Heres the problem:

string.c:699: error: conflicting types for 'getline'
/usr/include/sys/stdio.h:31: error: previous declaration of 'getline' was here
string.c:699: error: conflicting types for 'getline'
/usr/include/sys/stdio.h:31: error: previous declaration of 'getline' was here
make: *** [string.o] Error 1

---

Basically thats the error I get for every single codebase I try to compile. Any help would be greatly appreciated.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 24 Apr 2006 09:30 PM (UTC)
Message
What is your operating system? What is your environment? What is on line 699 of string.c?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Demitrus   (3 posts)  Bio
Date Reply #2 on Mon 24 Apr 2006 09:47 PM (UTC)
Message
char *numlineas( char *string )
{
int cnt = 1;
static char buf[MAX_STRING_LENGTH*2];
char buf2[MAX_STRING_LENGTH], tmpb[MAX_STRING_LENGTH];

buf[0] = '\0';

while ( *string )
{
string = getline( string, tmpb );
sprintf( buf2, "%2d. %s\n\r", cnt++, tmpb );
strcat( buf, buf2 );
}

return buf;
}

/* buf queda con la linea sin \n\r */
char *getline( char *str, char *buf )
{
int tmp = 0;
bool found = FALSE;

while ( *str )
{
if ( *str == '\n' )
{
found = TRUE;
break;
}

buf[tmp++] = *(str++);
}

if ( found )
{
if ( *(str + 1) == '\r' )
str += 2;
else
str += 1;
} /* para que quedemos en el inicio de la prox linea */

buf[tmp] = '\0';

return str;


----------
Those are the two parts of code im having trouble with. Well, just one, for now. The getline.
Top

Posted by Demitrus   (3 posts)  Bio
Date Reply #3 on Mon 24 Apr 2006 09:49 PM (UTC)
Message
I forgot the closing bracket, heres the correct two sections of code -

char *numlineas( char *string )
{
int cnt = 1;
static char buf[MAX_STRING_LENGTH*2];
char buf2[MAX_STRING_LENGTH], tmpb[MAX_STRING_LENGTH];

buf[0] = '\0';

while ( *string )
{
string = getline( string, tmpb );
sprintf( buf2, "%2d. %s\n\r", cnt++, tmpb );
strcat( buf, buf2 );
}

return buf;
}

/* buf queda con la linea sin \n\r */
char *getline( char *str, char *buf )
{
int tmp = 0;
bool found = FALSE;

while ( *str )
{
if ( *str == '\n' )
{
found = TRUE;
break;
}

buf[tmp++] = *(str++);
}

if ( found )
{
if ( *(str + 1) == '\r' )
str += 2;
else
str += 1;
} /* para que quedemos en el inicio de la prox linea */

buf[tmp] = '\0';

return str;
}
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Mon 24 Apr 2006 09:50 PM (UTC)
Message
What is your operating system? What is your environment?

The getline problem has been covered here before; have you tried searching in the ROM section?
Basically you'll need to rename the function to something else, and change all references to getline in your source code to your new function name.


Also, please use the code tag when posting code.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Samson   USA  (683 posts)  Bio
Date Reply #5 on Tue 25 Apr 2006 11:32 AM (UTC)

Amended on Tue 25 Apr 2006 11:35 AM (UTC) by Samson

Message
BTW, just to keep the record straight, AFKMud is not a ROM derivative and would not have been subject to this problem :)

The compiler error encountered is usually because you have a function sharing the same name as one from the standard includes. I don't recall hitting this with any of the stock Rom derivs I've tested but it is possible one or more flavors of GCC are to blame for this.

Best bet, find and rename the "getline" function in whatever file it's located in. Then rename all of the calls within the code to use the new name.
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.


19,076 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.