gpt4 book ai didi

c++ - 未解析的外部符号(LNK2019)

转载 作者:太空宇宙 更新时间:2023-11-04 15:31:10 25 4
gpt4 key购买 nike

<分区>

我是 C++ 新手。我正在尝试开发一个 C++ 应用程序,但有一个错误一直困扰着我。

Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)"

我想我已经在另一个文件中引用了我的所有函数

这是我的cpp文件的代码:

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

}

这是我在cpp文件中引用的“stdafx.h”头文件:

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



};

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com