[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  ROM
. -> [Folder]  Running the server
. . -> [Subject]  unresolved external symbol (dirent.h)
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

unresolved external symbol (dirent.h)

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by ShadowFangs   (3 posts)  [Biography] bio
Date Sun 03 Oct 2004 03:15 AM (UTC)  quote  ]
Message
Hey all, Using MSVC 6.0

I read that An unresolved external means that you have called a function or variable but that the function or variable is not defined in the code linked to the executable.

these are the errors.
error LNK2001: unresolved external symbol _closedir
error LNK2001: unresolved external symbol _readdir
error LNK2001: unresolved external symbol _opendir

Great, so that means that this function wont work.

void do_plist(CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
BUFFER *pbuf;
struct dirent *Dir;
DIR *Directory;
char FName[80];
char buf[MSL];
int nMatch, neat1;
char neat[MSL];
char neat2[MSL];
char neat3[MSL];

nMatch = 0;

pbuf = new_buf();
d = new_descriptor();
Directory = opendir( PLAYER_DIR );
Dir = readdir( Directory );
send_to_char("{C PLAYER BASE {x\n\r",ch);
send_to_char("{RName lvl Race Class {x\n\r",ch);
send_to_char("{R==============================================={x\n\r",ch);
while( Dir != NULL )
{
sprintf(FName, PLAYER_DIR "%s", Dir->d_name);
{
if (Dir->d_name[0] >= 'A' && Dir->d_name[0] <= 'Z')
{
nMatch++;
load_char_obj( d, Dir->d_name );
if ( d->character->level <= ML )
{
sprintf(neat, "%s", Dir->d_name);
neat1 = d->character->level;
sprintf(neat2,"%s", capitalize(race_table[d->character->race].name));
sprintf(neat3,"%s", capitalize(class_table[d->character->class].name));


sprintf(buf, "{B[{c%-12s{B][{c%-2d {B][{c%-10s {B][{c%-12s {B]{x\n\r",
neat, neat1, neat2, neat3);
add_buf(pbuf, buf);
}
}
}
Dir = readdir( Directory );
}
closedir( Directory );
page_to_char(buf_string(pbuf), ch);
free_buf(pbuf);
sprintf( buf, "\n\r{cPlayers found{C: {Y%d{x\n\r", nMatch );
send_to_char( buf, ch );
return;
}

Any suggestions?

[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #1 on Sun 03 Oct 2004 05:20 AM (UTC)  quote  ]
Message
Yeah, a little searching on google, looks like they functions are just not in MSVC. I did read something that said you can try to use some defines, like
    #ifdef MSVC 
    #define open _open 
    #define O_RDONLY _O_RDONLY 
    #define fstat fstat 
    #define S_ISREG(m) ((m)&_S_IFREG) 
    #endif
This comes from http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-users/mercury-users.0105/0076.html, that might help.

I also found this:
Quote:
One of the least standard aspects of libc is how to read what files are contained in a directory. Most DOS and Windows compilers have some kind of findfirst() and findnext() functions, but they differ as to exactly what these are called and what parameters they take. Posix systems (Unix, djgpp) have opendir() and readdir(), but these are missing from MSVC. So either don't do such things, or use the Allegro for_each_file() function, which is supported on all platforms.


I do not have MSVC myself, though, so I can't confirm any of this.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by ShadowFangs   (3 posts)  [Biography] bio
Date Reply #2 on Sun 03 Oct 2004 11:13 PM (UTC)  quote  ]
Message
Well, this being known now, is there any other way to do what i want this function to do? Any help is appreciated, thanks
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #3 on Sun 03 Oct 2004 11:55 PM (UTC)  quote  ]
Message
Well, one option is to forget MSVC and try something like cygwin. Its free and tends to work fairly well. This - http://msdn.microsoft.com/library/en-us/dnucmg/html/ucmglp.asp - may also be of some help.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Meerclar   USA  (569 posts)  [Biography] bio
Date Reply #4 on Mon 04 Oct 2004 01:32 AM (UTC)  quote  ]

Amended on Mon 04 Oct 2004 01:34 AM (UTC) by Meerclar

Message
Another option is to search the forum for dirent and copy the info Nick provided me a while back into a header file for your MSVC project.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Wed 06 Oct 2004 06:49 AM (UTC)  quote  ]
Message
I did a simulation of the dirent stuff. It is in the SMAUG port.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


12,480 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]