May 4th, 1999, 04:07 AM
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 );
}
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 );
}