Unable to compile gdiplus

Started by
4 comments, last by Evil Steve 15 years, 3 months ago
Hi, I just got started with cpp and decided I want to play around with some gamedevelpoment. I'm using Windows XP so I downloaded MinGW32 compiler and Microsoft Platform SDK. So I wrote a basic hello world app and included the gdiplus header. And this won't compile, the compiler errors are hundreds of "invalid use of undefined type", "enumerator value is not integer constant", "forward declaration" and so on. I believed these errors was the cause of the compiler didn't know where the correct libraries and headers were. So I tried to find out how to do this and MinGW was really cryptical about adding searchpaths, I couldn't find a way to add a searchpath directly and apparently all searchpaths you add are RELATIVE to where the sourcefiles are. C:\Program\MinGW C:\Program\Microsoft Platform SDK C:\cpp\game\Main.cpp Can anyone explain to me what to do and post the exact commandline to compile this file? File:Main.cpp ------------ #include <Windows.h> #include <gdiplus.h> using namespace Gdiplus; #include <iostream> int main(){ cout << "Hello World!"; return 0; }
Advertisement
Reformed question:
Is it even possible to compile using gdiplus headers with MinGW?
I doubt it. GDI+ is very obscure. I read about it while browsing once, tried to use it myself and there was little to no usable information available. GDI+ just exists. I don't think anybody actually uses it. Because you said that you just started programming in C++ is it safe to assume you've never touched just C? If so, just play with GDI. Remember to link libgdi32.a. Microsoft's Platform SDK doesn't come with GCC library types. Even if the headers worked you couldn't link GDI+. Having said that, the program reimp that comes with GCC does a wonderful job of converting Microsoft style libraries (coff?) to GCC style libraries. I used it to convert the pre-compiled DevIL libraries because I didn't want to have to try to compile the whole thing. Alternatively, you can download Microsoft's free (but gutted) version of Visual C++, Visual C++ Express Edition. Also, type your code in between [ source ] and [ /source ] tags w/o the spaces.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------I once read that World of Warcraft is poor fishing simulator. I don't know about you but I catch a lot more fish in World of Warcraft than I do in real life.
Quote:Original post by kittycat768
I doubt it. GDI+ is very obscure. I read about it while browsing once, tried to use it myself and there was little to no usable information available. GDI+ just exists.


There is a complete reference on MSDN.

Quote:Original post by kittycat768
I don't think anybody actually uses it.


If this is true for C or C++, it is more because very few people are using Win32 to develop GUI apps any more. I believe .NET uses GDI+ internally (the interface in C# is almost identical to the C++ version of the GDI+ library).

To the OP - it is pretty effortless to get GDI+ working with C++ if you use the free Visual Studio Express.

GDI+ uses gdiplus.dll, so you do need some kind of library file to statically link your project to it so you may have trouble with non-MS compilers. Having said that, I'd be suprised if it was impossible to use with MinGW.
Quote:Original post by EasilyConfused
Quote:Original post by kittycat768
I doubt it. GDI+ is very obscure. I read about it while browsing once, tried to use it myself and there was little to no usable information available. GDI+ just exists.


There is a complete reference on MSDN.

Quote:Original post by kittycat768
I don't think anybody actually uses it.


If this is true for C or C++, it is more because very few people are using Win32 to develop GUI apps any more. I believe .NET uses GDI+ internally (the interface in C# is almost identical to the C++ version of the GDI+ library).

To the OP - it is pretty effortless to get GDI+ working with C++ if you use the free Visual Studio Express.

GDI+ uses gdiplus.dll, so you do need some kind of library file to statically link your project to it so you may have trouble with non-MS compilers. Having said that, I'd be suprised if it was impossible to use with MinGW.


Really? I had such a hard time finding anything on GDI+ that I just shoved it aside. I think I'm going to try to get a hold of it and use reimp to convert the coff libraries. I don't normally give a hoot about GDI other than the fact that it contains a few OpenGL binding functions. GDI is the snail on the turles back going wohooo! Maybe GDI+ is better.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------I once read that World of Warcraft is poor fishing simulator. I don't know about you but I catch a lot more fish in World of Warcraft than I do in real life.
Quote:Original post by Dauid
I just got started with cpp and decided I want to play around with some gamedevelpoment. I'm using Windows XP so I downloaded MinGW32 compiler and Microsoft Platform SDK.
I'd recommend Microsoft Visual C++ 2008 Express instead, which is far superior for Windows development, and is still free and doesn't have any restrictions on what you do with the games and apps you create with it.

And I know for a fact that GDI+ works just fine with it [smile]

This topic is closed to new replies.

Advertisement