Need help with syntax to resolve compiler error. 
Author Message
 Need help with syntax to resolve compiler error.

I am trying to get the following GDI+ managed code to work, but I keep
getting a compiler error.  Can someone please help?  I know that this can be
done in standard GDI+, but I need it to work using the .NET GDI+ namespace.

{
  // This line produces Compiler error C2691: 'unsigned char  __gc[]' :
invalid type for __gc array element
   ImageCodecInfo ImageCodecs __gc[] = ImageCodecInfo::GetImageEncoders();

Quote:
}

I have also tried using the following, still no luck:

{
 ImageCodecInfo *ImageCodecs __gc[] = ImageCodecInfo::GetImageEncoders();

Quote:
}

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

-----------------------------------


Tue, 19 Jul 2005 22:12:01 GMT  
 Need help with syntax to resolve compiler error.
Even a simpler example (no gc[]'s involved) will fail with the same double C2691 errors :

System::Drawing::Imaging::ImageCodecInfo* x;
System::Guid g = x->get_Clsid();

My guess is that since the ImageCodecInfo class has members to back these following two properties, that the C++ compiler gets
confused.

public byte[][] SignatureMasks {get; set;}
public byte[][] SignaturePatterns {get; set;}

Quote:

> I am trying to get the following GDI+ managed code to work, but I keep
> getting a compiler error.  Can someone please help?  I know that this can be
> done in standard GDI+, but I need it to work using the .NET GDI+ namespace.

> {
>   // This line produces Compiler error C2691: 'unsigned char  __gc[]' :
> invalid type for __gc array element
>    ImageCodecInfo ImageCodecs __gc[] = ImageCodecInfo::GetImageEncoders();

> }

> I have also tried using the following, still no luck:

> {
>  ImageCodecInfo *ImageCodecs __gc[] = ImageCodecInfo::GetImageEncoders();

> }

> --
> -----------------------------------
> Ken Varn
> Senior Software Engineer
> Diebold Inc.

> -----------------------------------



Wed, 20 Jul 2005 05:34:52 GMT  
 Need help with syntax to resolve compiler error.
That's correct.  I hit this myself a while back.  The MC++ compiler does not
support jagged arrays (object[][]), therefore you cannot refer to any class
that uses them, such as ImageCodecInfo.

-Sean


Quote:
> Even a simpler example (no gc[]'s involved) will fail with the same double
C2691 errors :

> System::Drawing::Imaging::ImageCodecInfo* x;
> System::Guid g = x->get_Clsid();

> My guess is that since the ImageCodecInfo class has members to back these

following two properties, that the C++ compiler gets
Quote:
> confused.

> public byte[][] SignatureMasks {get; set;}
> public byte[][] SignaturePatterns {get; set;}




Quote:
> > I am trying to get the following GDI+ managed code to work, but I keep
> > getting a compiler error.  Can someone please help?  I know that this
can be
> > done in standard GDI+, but I need it to work using the .NET GDI+
namespace.

> > {
> >   // This line produces Compiler error C2691: 'unsigned char  __gc[]' :
> > invalid type for __gc array element
> >    ImageCodecInfo ImageCodecs __gc[] =

ImageCodecInfo::GetImageEncoders();
Quote:

> > }

> > I have also tried using the following, still no luck:

> > {
> >  ImageCodecInfo *ImageCodecs __gc[] =

ImageCodecInfo::GetImageEncoders();
Quote:

> > }

> > --
> > -----------------------------------
> > Ken Varn
> > Senior Software Engineer
> > Diebold Inc.

> > -----------------------------------



Wed, 20 Jul 2005 05:48:37 GMT  
 Need help with syntax to resolve compiler error.
So are you saying that this is a bug?  What is the solution?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

-----------------------------------

Quote:
> Even a simpler example (no gc[]'s involved) will fail with the same double
C2691 errors :

> System::Drawing::Imaging::ImageCodecInfo* x;
> System::Guid g = x->get_Clsid();

> My guess is that since the ImageCodecInfo class has members to back these

following two properties, that the C++ compiler gets
Quote:
> confused.

> public byte[][] SignatureMasks {get; set;}
> public byte[][] SignaturePatterns {get; set;}




Quote:
> > I am trying to get the following GDI+ managed code to work, but I keep
> > getting a compiler error.  Can someone please help?  I know that this
can be
> > done in standard GDI+, but I need it to work using the .NET GDI+
namespace.

> > {
> >   // This line produces Compiler error C2691: 'unsigned char  __gc[]' :
> > invalid type for __gc array element
> >    ImageCodecInfo ImageCodecs __gc[] =

ImageCodecInfo::GetImageEncoders();
Quote:

> > }

> > I have also tried using the following, still no luck:

> > {
> >  ImageCodecInfo *ImageCodecs __gc[] =

ImageCodecInfo::GetImageEncoders();
Quote:

> > }

> > --
> > -----------------------------------
> > Ken Varn
> > Senior Software Engineer
> > Diebold Inc.

> > -----------------------------------



Wed, 20 Jul 2005 05:59:16 GMT  
 Need help with syntax to resolve compiler error.
Write a C# helper dll to deal with this class.
Quote:

> So are you saying that this is a bug?  What is the solution?

> --
> -----------------------------------
> Ken Varn
> Senior Software Engineer
> Diebold Inc.

> -----------------------------------


> > Even a simpler example (no gc[]'s involved) will fail with the same double
> C2691 errors :

> > System::Drawing::Imaging::ImageCodecInfo* x;
> > System::Guid g = x->get_Clsid();

> > My guess is that since the ImageCodecInfo class has members to back these
> following two properties, that the C++ compiler gets
> > confused.

> > public byte[][] SignatureMasks {get; set;}
> > public byte[][] SignaturePatterns {get; set;}



> > > I am trying to get the following GDI+ managed code to work, but I keep
> > > getting a compiler error.  Can someone please help?  I know that this
> can be
> > > done in standard GDI+, but I need it to work using the .NET GDI+
> namespace.

> > > {
> > >   // This line produces Compiler error C2691: 'unsigned char  __gc[]' :
> > > invalid type for __gc array element
> > >    ImageCodecInfo ImageCodecs __gc[] =
> ImageCodecInfo::GetImageEncoders();

> > > }

> > > I have also tried using the following, still no luck:

> > > {
> > >  ImageCodecInfo *ImageCodecs __gc[] =
> ImageCodecInfo::GetImageEncoders();

> > > }

> > > --
> > > -----------------------------------
> > > Ken Varn
> > > Senior Software Engineer
> > > Diebold Inc.

> > > -----------------------------------



Wed, 20 Jul 2005 06:11:51 GMT  
 Need help with syntax to resolve compiler error.
I was hoping there would be a better solution for this than writing a C#
wrapper.  Are you sure that there is not some way that I could cast this
call?  I have tried to cast it to an Array *, Object *, etc..  There has to
be a better way than writing a C# wrapper.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

-----------------------------------

Quote:
> Write a C# helper dll to deal with this class.




Quote:
> > So are you saying that this is a bug?  What is the solution?

> > --
> > -----------------------------------
> > Ken Varn
> > Senior Software Engineer
> > Diebold Inc.

> > -----------------------------------


> > > Even a simpler example (no gc[]'s involved) will fail with the same
double
> > C2691 errors :

> > > System::Drawing::Imaging::ImageCodecInfo* x;
> > > System::Guid g = x->get_Clsid();

> > > My guess is that since the ImageCodecInfo class has members to back
these
> > following two properties, that the C++ compiler gets
> > > confused.

> > > public byte[][] SignatureMasks {get; set;}
> > > public byte[][] SignaturePatterns {get; set;}



> > > > I am trying to get the following GDI+ managed code to work, but I
keep
> > > > getting a compiler error.  Can someone please help?  I know that
this
> > can be
> > > > done in standard GDI+, but I need it to work using the .NET GDI+
> > namespace.

> > > > {
> > > >   // This line produces Compiler error C2691: 'unsigned char
__gc[]' :
> > > > invalid type for __gc array element
> > > >    ImageCodecInfo ImageCodecs __gc[] =
> > ImageCodecInfo::GetImageEncoders();

> > > > }

> > > > I have also tried using the following, still no luck:

> > > > {
> > > >  ImageCodecInfo *ImageCodecs __gc[] =
> > ImageCodecInfo::GetImageEncoders();

> > > > }

> > > > --
> > > > -----------------------------------
> > > > Ken Varn
> > > > Senior Software Engineer
> > > > Diebold Inc.

> > > > -----------------------------------



Fri, 22 Jul 2005 22:00:08 GMT  
 Need help with syntax to resolve compiler error.
As I see it, somebody has to figure out how to extract information out of  "ImageCodecInfo".
Since the C++ compiler can not handle this class, some one else has to.
Another route is you can write a wrapper in C++ for a call to the GDI+ API and define your own "ImageCodecInfo" struct .
Quote:

> I was hoping there would be a better solution for this than writing a C#
> wrapper.  Are you sure that there is not some way that I could cast this
> call?  I have tried to cast it to an Array *, Object *, etc..  There has to
> be a better way than writing a C# wrapper.

> --
> -----------------------------------
> Ken Varn
> Senior Software Engineer
> Diebold Inc.

> -----------------------------------



Sat, 23 Jul 2005 09:55:00 GMT  
 Need help with syntax to resolve compiler error.
Quote:


>As I see it, somebody has to figure out how to extract information out of  
"ImageCodecInfo".
>Since the C++ compiler can not handle this class, some one else has to.
>Another route is you can write a wrapper in C++ for a call to the GDI+ API

and define your own "ImageCodecInfo" struct .
Quote:




Quote:
>> I was hoping there would be a better solution for this than writing a C#
>> wrapper.  Are you sure that there is not some way that I could cast this
>> call?  I have tried to cast it to an Array *, Object *, etc..  There has
to
>> be a better way than writing a C# wrapper.

Unfortunately this is a limitation of the managed C++ compiler version you
are using.  We currently do not support jagged arrays so you can't consume
this class in MC++.

--
Steven Toscano, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.



Sun, 24 Jul 2005 03:24:10 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Need help to resolve errors in using Shared libraries

2. need help to resolve this error

3. Help needed: resolving CList SerialialElements link error

4. syntax error??????need help solving this

5. Syntax Error in Templates in 2003 Final Beta Compiler

6. syntax error or compiler bug?

7. Compiler errors.. help needed

8. Need help with compiler error

9. Help Needed.Compiler Error

10. **Borland C DOS compiler command syntax help for newbie

11. **Borland C DOS compiler command syntax help for newbie

12. HELP , HELP , HELP - I need a compiler

 

 
Powered by phpBB® Forum Software