This is Visual C++ on drugs . . .

Apr 13, 2008 15:37

So, I'm working on programming homework the day before it's due (as usual). At the class' beginning (back in January), we were strongly encouraged to download and install the Visual C++ Express 2005, and use it to compile and run our homework ( Read more... )

m$ sucks, weirdness

Leave a comment

Comments 4

jojomojo April 13 2008, 23:47:17 UTC
Your problem here I think is that you can't specify a multidimensional array, the first dimension of which is unbounded (i.e. []). This is because the compiler has no idea how to turn a two-dimensional offset into a pointer offset without knowing how big each 'row' in the array is.

Actually, the problem might be deeper than that - why do you have [] at all? the only place you should see [] is in the definition of a function's parameters...

Unfortunately, compiler error messages often do leave a lot to be desired :/

Reply

murstein April 14 2008, 01:02:26 UTC
Doh! Thanks. Those were the lines where I was passing the arrays to functions. My problem was forgetting that passing the array to a function is the only time you don't use the brackets.

Now I only have one error left. The message says "error C2109: subscript requires array or pointer type," and every variable on the line it references is an array . . .

Reply

murstein April 14 2008, 01:42:41 UTC
And, oddly enough, when I renamed one of the variables, that error went away.

Reply


crm17 April 22 2008, 22:55:28 UTC
I am coming late to this but the key to many compiler errors is it shows you the first character that it came to but expected something else. So it was looking for array info and instead ran into "]", and that is what it spits out in the error message.

Reply


Leave a comment

Up