Solved

Unresolved external symbols

Posted on 2001-08-07
12
471 Views
Last Modified: 2012-05-04
Hi guys,
think you can tell me which libs these are coming from (running Win NT VC++)

Linking...
directory.obj : error LNK2001: unresolved external symbol _closedir
directory.obj : error LNK2001: unresolved external symbol _readdir
directory.obj : error LNK2001: unresolved external symbol _opendir
LIBCD.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/mytron2.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

Thanks!
0
Comment
Question by:amozes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6361790
closedir is not part of VC++, that is a unix function.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6361793
_closedir, _readdir, and _opendir are all Unix functions.
Some other compilers use these functions as well, but VC++ does not.

Use findfirst and findnext
0
 
LVL 30

Accepted Solution

by:
Axter earned 50 total points
ID: 6361798
_findfirst, _findfirsti64, _wfindfirst, _wfindfirsti64
Provides information about the first instance of a filename that matches the file specified in the filespec argument.
long _findfirst( char *filespec, struct _finddata_t *fileinfo );
__int64 _findfirsti64( char *filespec, struct _finddata_t *fileinfo );
long _wfindfirst( wchar_t *filespec, struct _wfinddata_t *fileinfo );
__int64 _wfindfirsti64( wchar_t *filespec, struct _wfinddata_t *fileinfo );

_findnext, _findnexti64, _wfindnext, _wfindnexti64
Find the next name, if any, that matches the filespec argument in a previous call to _findfirst, and then alters the fileinfo structure contents accordingly.
int _findnext( long handle, struct _finddata_t *fileinfo );
__int64 _findnexti64( long handle, struct _finddata_t *fileinfo );
int _wfindnext( long handle, struct _wfinddata_t *fileinfo );
__int64 _wfindnexti64( long handle, struct _wfinddata_t *fileinfo );

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:amozes
ID: 6361883
Thanks for the info on the dirs question.  Still stuck on the _main one.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6361896
Do you have a main() function in your code?
0
 

Author Comment

by:amozes
ID: 6361936
Yes.  I'm not sure how to tell the compiler that this file (call it main.c) is the one that contains the main function.
0
 

Author Comment

by:amozes
ID: 6361946
That made me realize that I am working with C files and not C++ files (does this make a difference)?  I remember hearing about using console vs. win32 apps.  Which one should I be using?  Right now I'm using console.
0
 

Author Comment

by:amozes
ID: 6361989
That made me realize that I am working with C files and not C++ files (does this make a difference)?  I remember hearing about using console vs. win32 apps.  Which one should I be using?  Right now I'm using console.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6362030
>>That made me realize that I am working with C files and
>>not C++ files (does this make a difference)?
It makes a different with VC++.  By default VC++ will compile *.c files as C code, and *.cpp files as C++ code.

You must include your main.c file to the project.
To do this, click on Project on the main menu, and then click Add-To-Project
Then click FILES, and select the file you want to add to your project.

You need to do this for all the project files.

>>Right now I'm using console.
I'm sure this is what you want to use.
0
 

Author Comment

by:amozes
ID: 6362048
I already did that.  Do I have to call the file that contains the main function by the same name as the project?
For example if my project was called testapp, do I have to have a testapp.c?
0
 

Author Comment

by:amozes
ID: 6362076
Well, I renamed it to the project name, but to no avail... I'm opening up a new question based on it.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6362110
>>Do I have to call the file that contains the main
>>function by the same name as
>>the project?
No.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question