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);


    }
}

Recommended Answers

All 4 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.