flexible array member

Hello I have a problem:
I have 4 files: AllOnesGA.cpp, Population.h, Individual.h, GeneticAlgorithm.h

In Individual.h I declare
int chromosome[];
And an error message was thrown
error: flexible array member ‘Individual::chromosome’ not at end of ‘class Individual’

What I'm doing wrong?
> What I'm doing wrong?
1. Using a FAM when you should be using std::vector.

2. Not reading the error message.
"not at end of ‘class Individual’" is very specific.
You can only have one FAM, and it MUST be the last member of the class/struct.
What is a FAM?
You wrote it yourself
FAM = Flexible Array Member.
who knows
ISO C++ forbids flexible array member
Registered users can post here. Sign in or register to post.