gpt4 book ai didi

c++ - 错误 LNK2019 : unresolved external and LNK1120: 1 unresolved externals

转载 作者:行者123 更新时间:2023-11-28 06:34:56 26 4
gpt4 key购买 nike

在编译我的代码时,我收到此错误。

1>MSVCRTD.lib(crtexe.obj):错误 LNK2019:函数 ___tmainCRTStartup 中引用了未解析的外部符号 _main1>C:\Users\Gabe Phelan\Documents\Visual Studio 2013\Projects\PA3 test\Debug\PA3 test.exe : fatal error LNK1120: 1 unresolved externals

#include <iostream>
#include <vector>
using namespace std;

class Heap{
private:

vector<int> heap;
int size;

public:
Heap(bool x);

};

#include "Header.h"

Heap::Heap(bool order){
int dummy = 0;
heap.push_back(dummy);
size = heap.size() - 1;

}

最佳答案

你必须有一个入口点,它是一个叫做 main 的函数。所以你需要这个,

int main(int argv, char* argc[])
{
//your code here
}

你不在这里声明类,而是你希望程序执行什么。

关于c++ - 错误 LNK2019 : unresolved external and LNK1120: 1 unresolved externals,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26921949/

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