I am new to C++ . I am trying to develop a C++ application but there is one error that is keep bothering me.
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)"
I think I have referenced all of my functions in another file
This is the code of my cpp file:
#include "stdafx.h"
int console::main()
{
system("cls");
cout << "-----------ABC Homestay Management System-----------" << endl;
cout << "------------------------------------------------------------" << endl;
system("color 0f");
cout << "Please enter your choice" << endl;
cout << "1.Upload listings" << endl;
cout << "2.Find listings" << endl;
cout << "3.View listings" << endl;
cout << "4.Exit" << endl;
int choice;
cin >> choice;
switch (choice) {
case 1:
//renter();
break;
case 2:
//finder();
break;
case 3:
//listings();
break;
case 4:
exit(0);
break;
case 8:
//staff();//secret key -> 8 for staff
break;
}
system("pause");
main();
return 0;
}
void console::finder() {
system("cls");
cout << "test" << endl;
}
This is the "stdafx.h" header file that I have referenced in the cpp file :
#pragma once
#include "targetver.h"
#include <iomanip>
#include <ctime>
#include <time.h>
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <regex>
#include <stdlib.h>
#include <string.h>
#include<algorithm>
#include<iterator>
#include <chrono>
#include <thread>
using namespace std;
class console {
public:
console() {}
~console() {}
int main();
void renter();
void finder();
void listings();
void staff();
};