0

Are there any restrictions on creating vectors with custom classes? Recently, my compiler has been sending a 'LNK1120' warning whenever I attempt the statement:

vector<Team> teamList;

If this is illegal, is there a workaround that would allow me to store/organize a group of these instances? Thanks.

Michael Hang
  • 199
  • 2
  • 2
  • 15

2 Answers2

1

LNK2001 followed by LNK1120 are linkers error. It isn't (inherently) related to your custom vector type.

Looking at your code, I can see two possible reasons here :

  1. you just forgot using std::vector or using namespace std; and the linker can't find what you mean by vector
  2. the piece of code above isn't linked to the object containing the class Team

And of course, creating a vector with custom classes isn't illegal at all.

Erwan Queffélec
  • 716
  • 1
  • 6
  • 20
0

LNK1120 - unresolved externals?

We need more source code and linker output.

DemiDroL
  • 343
  • 3
  • 8