Hello, so I have the following declaration which gives me the error "a new initializer may not be specified for an array". I am using visual studio 2013 c++.
//22,500 individual blocks
int gridSize = 150;
//1024 threads contained within each block
int blockSize = 32;
int totalNumThreads = (gridSize*gridSize)*(blockSize*blockSize);
indvPasswords* pointerToPass = new indvPasswords[totalNumThreads];
A solution would be much appreciated as I have no idea as to why this is occurring. Thank you.
Visual studio responds to your code fragment with "error C2065: 'indvPasswords' : undeclared identifier"
"new initializer may not be specified for an array" indicates that you have an array new followed by a pair of round parentheses with something between them: new type[size](initializer), which is not allowed (see for example http://en.cppreference.com/w/cpp/language/new#Construction ) . The correct solution is to use std::vector.
struct indvPasswords
{
int blockId;
int threadId;
list<char[1024]> passwords;
};
which is used to hold data within the array. And no where else in my code do i declare anything new. Would you like me to post the entire source code? its about 200 lines
What is generally expected when asking others to debug a program is the shortest complete program that reproduces the issue (although the error often becomes obvious when preparing such program)
Assuming your list is actually std::list, the struct is invalid because char[1024] does not satisfy the requirements of Eraseable with the default allocator, although it appears only clang/libc++ diagnoses that with just the code fragment you posted so far: