please help external error
Hi.
I used an example in visual c++(5), but i get an unresolved error when trying to create the exe file. compiling works
fine..
The code is listed below.. Any help would be great.
the error is: "error LNK2001: unresolved external symbol _WinMain@16"
code:
/* FGETC.C: This program uses getc to read the first
* 80 input characters (or until the end of input)
* and place them into a string named buffer.
*/
#include
#include
void main( void )
{
FILE *stream;
char buffer[81];
int i, ch;
/* Open file to read line from: */
if( (stream = fopen( "fgetc.c", "r" )) == NULL )
exit( 0 );
/* Read in first 80 characters and place them in "buffer": */
ch = fgetc( stream );
for( i=0; (i < 80 ) && ( feof( stream ) == 0 ); i++ )
{
buffer[i] = (char)ch;
ch = fgetc( stream );
}
/* Add null to end string */
buffer[i] = '\0';
printf( "%s\n", buffer );
fclose( stream );
}
Re: please help external error
Make a new project : MFC Console Application. Select the empty project.
Every program must have an entry point. In a console program this is the main()-function. In a windowsprogram this is the winmain()-function. The problem here is that by default winmain() is used.
For an empty console project the default is the main().