error LNK2019: unresolved external and LNK1120: 1 unresolved externals

966 views Asked by At

When compiling my code I receive this error.

1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 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;

}
1

There are 1 answers

0
user3427457 On

You have to have have an entry point, which is a function called main. So you need this,

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

You dont declare classes in this, but what you want the program to execute.