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

标签 c++ lnk2019

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

1>MSVCRTD.lib(crtexe.obj):错误 LNK2019:函数 ___tmainCRTStartup 中引用了未解析的外部符号 _main 1>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/

相关文章:

c++ - 在 ubuntu 10.04 下安装最新的 1.44 boost 库

c++ - 检测到堆损坏?

c++ - 使用自定义工具集获取动态 atexit 析构函数链接错误 - eh vector destructor

c++ - wstring -> ShellExecute 中的 LPCWSTR 给我错误 LNK2028 和 LNK2019

c++ - 重构 C++ 代码以使用脚本语言?

c++ - 仅使用指针算法遍历 PE 文件格式的已加载 DLL/EXE

C++:错误 LNK:无法解析的外部符号,由虚函数产生

c++ - 使用 Boost.Geometry 计算线和多边形之间的交点

c++ - 错误 LNK2019 : unresolved external symbol "public: void __thiscall