【问题标题】:error LNK2019: unresolved external and LNK1120: 1 unresolved externals错误 LNK2019:未解决的外部和 LNK1120:1 未解决的外部
【发布时间】:2015-01-11 08:52:28
【问题描述】:

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

1>MSVCRTD.lib(crtexe.obj) : 错误 LNK2019: 函数 ___tmainCRTStartup 中引用的未解析的外部符号 _main 1>C:\Users\Gabe Phelan\Documents\Visual Studio 2013\Projects\PA3 test\Debug\PA3 test.exe : 致命错误 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函数。
  • 哪里,哦,入口点在哪里?

标签: c++ lnk2019


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-03
    • 2014-05-10
    • 2017-09-25
    • 2014-05-07
    • 2022-01-05
    • 2011-11-16
    相关资源
    最近更新 更多