Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2004

Tip: Looking for answers? Try searching our database.

LNK2001 - unresolved external symbol (stat)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Murray Foxcroft - 01 Jun 2004 17:38 GMT
Hi all -

Can anyone tell me what I should link in to get the following error sorted?
Also - for future reference - any quick ways to resolve a linker reference
from an include like #include <sys/stat.h> in order to beat these linker
errors quickly?

error LNK2001: unresolved external symbol "int __cdecl stat(char const
*,struct stat *)" (?stat@@$$J0YAHPBDPAU0@@Z)
Thobias Jones - 01 Jun 2004 18:32 GMT
> Also - for future reference - any quick ways to resolve a linker reference
> from an include like #include <sys/stat.h> in order to beat these linker
> errors quickly?

There isn't necessarily a correllation between header includes and
linker import libraries.  You should consult your API documentation to
find out what import libraries are required for the functions you intend
to link against.  In general, Visual Studio sets up default import
libraries for common Windows APIs and the C standard library.

The function stat() should have been included in one of those default
libraries, likely libcmt.lib.  I haven't physically checked this myself
for the case of stat(), but this is what the documentation has.

Thobias Jones
Murray Foxcroft - 02 Jun 2004 06:27 GMT
Thanks Thobias,

As far as the documentation is concerned, it should have been in
msvcrt.lib - which is linked in to my project already. 8-(

>> Also - for future reference - any quick ways to resolve a linker
>> reference from an include like #include <sys/stat.h> in order to beat
[quoted text clipped - 11 lines]
>
> Thobias Jones
Thobias Jones - 02 Jun 2004 14:58 GMT
> Thanks Thobias,
>
> As far as the documentation is concerned, it should have been in
> msvcrt.lib - which is linked in to my project already. 8-(

Is there some reason you are linking against stat() instead of _stat()?
 If you really need stat(), link against oldnames.lib.

Thobias Jones
http://ace.roqs.net
Murray Foxcroft - 03 Jun 2004 06:36 GMT
I got away with using the managed stuff - File.Exists and <myfile>.Length

Thanks for the help tho - much appreciated.

>> Thanks Thobias,
>>
[quoted text clipped - 6 lines]
> Thobias Jones
> http://ace.roqs.net

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.