Hello,
I'm trying to use my native code that using GDI+ in my CLR application using the Visual Studio 2003 but it refuses to include gdiplus.h But it generate many and many of errors to me and I show you few of them below:
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2501: 'MIDL_INTERFACE' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2440: 'initializing' : cannot convert from 'const char [37]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2146: syntax error : missing ';' before identifier 'IImageBytes'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2470: 'IImageBytes' : looks like a function definition, but there is no formal parameter list; skipping apparent body
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2059: syntax error : 'public'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2146: syntax error : missing ';' before identifier 'id'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2501: 'Gdiplus::PropertyItem::PROPID' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2501: 'Gdiplus::PropertyItem::id' : missing storage-class or type specifiers
And many and many of that . I don't know what to do . But when I tried to use the same code in a new WIN32 application It refuses too and generates these errors.
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2501: 'MIDL_INTERFACE' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2440: 'initializing' : cannot convert from 'const char [37]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2146: syntax error : missing ';' before identifier 'IImageBytes'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2470: 'IImageBytes' : looks like a function definition, but there is no formal parameter list; skipping apparent body
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67) : error C2059: syntax error : 'public'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2146: syntax error : missing ';' before identifier 'id'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2501: 'Gdiplus::PropertyItem::PROPID' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(246) : error C2501: 'Gdiplus::PropertyItem::id' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GdiPlusHeaders.h(384) : error C2143: syntax error : missing ')' before '*'
And as I think it's the same type of the errors generated from the CLR application.
Can any body help
Thanks,
Mustafa ELBanna

Can't #Include <gdiplus.h> to my Win32 application
Mattias Jonsson
Try to do changes so that you have the previous code and see which change exactly leads to the errors.
Thanks,
Ayman Shoukry
VC++ Team
Jeaux
I simply wrote this as you said and it worked!!:-)
#include
<Windows.h>#include
<gdiplus.h>using
namespace Gdiplus;#include
<iostream>int
main(){
return 0;}
Thanks,
Mustafa ELBanna
DougS
Thanks,
Ayman Shoukry
VC++ Team
Eric Sanders
Any ways, if you are using the Express SKU of VC2005, here is a good link on how to use the Platform SDK headers with it:
http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx
Hope this helps!
Thanks,
Ayman Shoukry
VC++ Team
Sam Larko
I really can't understand, but what if I tell you that I test now to use Windows.h on Visual C++ Express 2005 and it refuses to work although I copied the include and the libarary files of the platform SDK into VC8 directories!!
Thanks.
KJ-JC1974
Thanks,
Ayman Shoukry
VC++ Team
ChrislRoy
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
WIN32_LEAN_AND_MEAN prevents a lot of stuff from being included. Just comment it out. That's all there is to it.Belazor
Thanks,
Ayman Shoukry
VC++ Team
jeroln
Hello,
I just tried to make a simple WIN32 APP use the GDI+ for a test and it fails too. All I make just include <gdiplus.h> at stdafx.h after Windows.h, but it didn't works. I put it in the CPP files that I use it generates the same messages that I showed a sample from it in my first post!
Thanks,
Mustafa ELBanna
Chandra Murali
First, Thanks for replying. Second, It doesn't really appear to work on any Visual Studio Version and I tried to see if any project setting are missed up but I can't find any something strange too.
Thanks,
Mustafa ELBanna