I'm working on a program:
#include <iostream>
#include <vector>
#include <utility> //std::pair, std::make_pair
using namespace std;
class User {
private:
size_t userIndex;
vector< pair<int,int> > ratings;
public:
void addRating(int movieIndex, int rating) {
ratings.push_back( make_pair(movieIndex, rating) );
}
};
However, when I compile it with g++ I get the following error:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../lib/libcygwin.a(libcmain.o): In function `main':
/usr/src/debug/cygwin-1.7.28-1/winsup/cygwin/lib/libcmain.c:39: undefined reference to `WinMain'
/usr/src/debug/cygwin-1.7.28-1/winsup/cygwin/lib/libcmain.c:39:(.text.startup+0x7e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `WinMain'
collect2: error: ld returned 1 exit status
Interestingly, when I comment out the following line, this error goes away:
//vector< pair<int,int> > ratings;
Why is this happening when this line is uncommented?