Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 490
  • Last Modified:

Unresolved external symbols

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
amozes
Asked:
amozes
  • 6
  • 6
1 Solution
 
AxterCommented:
closedir is not part of VC++, that is a unix function.
0
 
AxterCommented:
_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
 
AxterCommented:
_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
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!

 
amozesAuthor Commented:
Thanks for the info on the dirs question.  Still stuck on the _main one.
0
 
AxterCommented:
Do you have a main() function in your code?
0
 
amozesAuthor Commented:
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
 
amozesAuthor Commented:
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
 
amozesAuthor Commented:
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
 
AxterCommented:
>>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
 
amozesAuthor Commented:
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
 
amozesAuthor Commented:
Well, I renamed it to the project name, but to no avail... I'm opening up a new question based on it.
0
 
AxterCommented:
>>Do I have to call the file that contains the main
>>function by the same name as
>>the project?
No.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now