Work-around for char StringName[k][Max] related error in MSVC++ ver 6.0 
Author Message
 Work-around for char StringName[k][Max] related error in MSVC++ ver 6.0

Hi ...

I'm working in Visual C++ ver 6.0. Strangely, the complier generates
the following errors in response to the declaration:
char StringName[k][Max];

error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2087: '<Unknown>' : missing subscript
error C2133: 'WaveFileList' : unknown size

Microsoft acknowledges that this is indeed a bug (BUG: Cannot Cast
Double to int for Use in an Array Declarator)in its compiler and
suggests a work-around that I cannot fit in this situation.

Any ideas?

Thanks

- Olumide



Wed, 02 Feb 2005 05:08:24 GMT  
 Work-around for char StringName[k][Max] related error in MSVC++ ver 6.0

Quote:

> I'm working in Visual C++ ver 6.0. Strangely, the complier generates
> the following errors in response to the declaration:
> char StringName[k][Max];

Are `k' and `Max' constant expressions?


Wed, 02 Feb 2005 05:11:02 GMT  
 Work-around for char StringName[k][Max] related error in MSVC++ ver 6.0


Quote:
> I'm working in Visual C++ ver 6.0. Strangely, the complier generates
> the following errors in response to the declaration:
> char StringName[k][Max];

> error C2057: expected constant expression
> error C2466: cannot allocate an array of constant size 0
> error C2057: expected constant expression
> error C2466: cannot allocate an array of constant size 0
> error C2087: '<Unknown>' : missing subscript
> error C2133: 'WaveFileList' : unknown size

> Microsoft acknowledges that this is indeed a bug (BUG: Cannot Cast
> Double to int for Use in an Array Declarator)in its compiler and
> suggests a work-around that I cannot fit in this situation.

If k and Max are not either enums or #defines then you cannot use them as
array size indexes for C programs. You must use a compile time constant
expression. You'll have to wait for a C99 compiler to do it with
variables.


Wed, 02 Feb 2005 05:20:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I look for c microsoft ver 6.0 or ver 7.0 for [dos] urgently

2. Error in Release ver not in Debug ver??

3. Domodal() error, how can i work around?

4. Error in MSVC 6.0 headers...

5. Error in MSVC++ 6.0

6. MSVC 5.0 -> 6.0 XML processing error

7. new to msvc++ 6.0

8. Using MSVC 5.0 and MSVC 6.0 On One Machine

9. Can I mix MSVC 4.0 and MSVC 6.0?

10. Q147740 CWnd work-around doesn't work with control that uses lic file

11. still needing help in MSVC ver 4,

12. File-open button stops working in msvc++ 4.2

 

 
Powered by phpBB® Forum Software