Don't understand fatal error message.


LINK : fatal error LNK1561: entry point must be defined

Isn't main() the entry point?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

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

int main ()
{
  vector<int> first;
  vector<int> second;
  vector<int> third;

  first.assign (7,100);             // a repetition 7 times of value 100

  vector<int>::iterator it;
  it=first.begin()+1;

  second.assign (it,first.end()-1); // the 5 central values of first

  int myints[] = {1776,7,4};
  third.assign (myints,myints+3);   // assigning from array.

  cout << "Size of first: " << int (first.size()) << endl;
  cout << "Size of second: " << int (second.size()) << endl;
  cout << "Size of third: " << int (third.size()) << endl;
  return 0;
}
Are you sure you this is a console application project?
No, I'm not sure. I'm researching vector because I'm having a problem with an exercise in the book I'm reading. I copied this code from cplusplus.com so I could do some experimenting.
Make sure that this is a console application project. What IDE do you use? Create a new project and select console application.

main indicates the entry point in console applications. My guess is that your project is something else whose entry point is indicated in some other way (for example in a windows application the entry point is WinMain)
Thanks m4ster r0shi, that was the problem. I put it into jEdit and got the error. As you suggested I created a new project in VC++ Express Edition and it compiled and executed without error. Although VC++ Express adds a half dozen files I don't understand I think I'll use it from now on.

Thanks again,
b52
No problem.

b52 wrote:
Although VC++ Express adds a half dozen files I don't understand I think I'll use it from now on.

CodeBlocks is a very good option too -> http://www.codeblocks.org/
Topic archived. No new replies allowed.