The program below wont run due to the following errors :
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals

Please help me to solve these errors.

#include<stdio.h>
#include<conio.h>
#include<Windows.h>


int Choice=1;
char opt;
int ch=0;

void Main()
{

    while (ch!=4)
    {
        printf ("\n*****************************");
        printf ("\n Enter 1 to view stock menu");
        printf ("\n*****************************");
        printf ("\n*****************************");
        printf ("\nEnter 2 to add item to stock");
        printf ("\n*****************************");
        printf ("\n*****************************");
        printf ("\nEnter 3 to view added items to stock");
        printf("\n*****************************");
        printf("\n*****************************");
        printf("\nEnter 4 to exit interface");
        printf("\n*****************************");
        scanf("%d",&ch);


    }
}

lol forget this post solved the problem Main should be changed to main .

Furthermore, it should be int main() not, void main(), and you should have return 0; at the end of your program.

actually u dont have to use int main and return 0. what is the point of using int main and return 0 when i can just use void main and the program still runs. lol and i think you know this already u just had to post something right?? :D

Edited 4 Years Ago by jaymayne

actually u dont have to use int main and return 0. what is the point of using int main and return 0 when i can just use void main and the program still runs. lol and i think you know this already u just had to post something right?? :D

Edited 4 Years Ago by jaymayne

This question has already been answered. Start a new discussion instead.