Re: Problems compiling GDI+ (GDIPlus) example from MSDN
by MW Ron <mwron@[EMAIL PROTECTED]
>
Feb 24, 2005 at 06:36 PM
In article <9dee03ea.0502220452.4fef06ac@[EMAIL PROTECTED]
>,
omo@[EMAIL PROTECTED]
wrote:
>Hi,
>
>I'm trying to compile a simple GDI+ program with MW_CW_Win_9.4
>(example for drawing a line from msdn) and am having difficulties to
>compile it.
>code example link:
>http://msdn.microsoft.com/library/en-us/gdicpp/GDIPlus/usingGDIPlus/gettingstar
>ted/drawingaline.asp?frame=true
>
>I started with a fresh project(win32 c++ exe with default libs, added
>gdiplus.lib to project) and just copied the code from the example.
>Upon trying to compile I get following error message:
>
>'undefined identifier EmfPlusRecordType' on line 534 in
>"GdiPlusEnums.h", which seems to be a forward declaration for a
>following enum.
>After commenting the line followin error occured:
>'undefined identifier max' on line 482 in "GdiPlusTypes.h"
>
Win32 defines two macros called min and max (in windef.h); these can
conflict with the ANSI C++ min and max template functions. This
happens if you #include windows.h and one of the ANSI C++ headers that
declare or call the template min and max functions.
However, MS's min/max can be disabled by putting the line
#define NOMINMAX
before the #include of windows.h. (the min and max macro definitions
are enclosed in an #ifdef NOMINMAX block in windef.h).
Since the stationery uses precompiled headers you will need to change
the .pch++ file and precompile the MSLHeaders again.
In the Windows precompiled headers project
Win32-x86 Sup****t
Headers
Precompiled Headers
Win32Headers.mcp
Open the .pch or .pch++ file and for example Win32Headers.pch
#pragma precompile_target "Win32Headers.mch"
// #pragma once on
#include "ansi_prefix.win32.h"
#include <windows.h>
change that to
#pragma precompile_target "Win32Headers.mch"
// #pragma once on
#include "ansi_prefix.win32.h"
#define NOMINMAX
#include <windows.h>
Ron
--
Metrowerks Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community
--
Ron Liechty - MWRon@[EMAIL PROTECTED]
- http://www.metrowerks.com