initializer element is not constant
tcstory opened this issue · comments
environment: ubuntu 18.04 ,gcc version 7.3.0
I had finished the part 3, but when i compile the source code, it reports the following two type errors:
(1) variably modified ‘username’ at file scope
char username[COLUMN_USERNAME_SIZE];
(2) initializer element is not constant
const uint32_t USERNAME_OFFSET = ID_OFFSET + ID_SIZE;
I had google the problem,one question at stackoverflow say that this is because the const just means "read only" not a real constant.
I'm very interested in how can you compile the code successfully.
@tcstory What is the full error that you are seeing ? Also, paste the relevant code around the error.
@ashishnegi this is the partial errors
@zhazhalaila i know change "const" to "define" will solve the problem, i just curious about how the author complie the code without any error.
@tcstory Hi! I developed this on a mac, so it's possible some code worked for me that didn't work for you. Any contributions that make the code more portable are welcome!