 |
|
|
 |
|
 |
Hi all,
I came across an error with gdiplus headers and the new operator in debug builds. I was able to build the project in release mode, but not in debug. In case anyone else has this kind of behavior, take a look at the following thread on msdn.
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/2a0d2944-af25-4617-9402-4b1f26294409[^]
If you have similar problems in debug mode try this code to see if it gets better:
// The debug new causes problems in gdiplus header files,
// deactivate it.
#ifdef _DEBUG
#undef new
#endif
#include <gdiplus.h>
// reactivate debug new when in debug mode
#ifdef _DEBUG
#define new new(__FILE__, __LINE__)
#endif
|
|
|
|
 |
|
 |
Using VS6,
I got:
"gdiplus.lib(imagingguds.obj) : fatal error LNK1103: debugging information corrupt; recompile module"
when compiling in debug mode, but links fine in release mode.
I've created a VS6Libs folder for my projects. Within that I have copied in gdiplus.lib from the Feb2003 SDK (dated 2003-03-26).
Added
#pragma comment (lib, ".....\\VS6Libs\\gdiplus.lib") // change ..... to appropriate folder
and it now compiles and links fine in debug mode.
|
|
|
|
 |
|
 |
It is very important to define ULONG_PTR type correctly.
It must be defined as a unsigned __int32, if you have a 32 bit processor.
This information has been provided by "Anonymous" and it has been very useful for me.
This tip allowed me to solve the linker error "Unresolved external link GdiplusShutdown".
|
|
|
|
 |
|
 |
When i build it, i get following errors:
Project : Win32 Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Dokumente und Einstellungen\Andi\Eigene Dateien\Eigene Programme\GDI+Tutorial_cpp\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
In file included from C:/Programme/CodeBlocks/include/gdi+/gdiplus.h:34,
from main.cpp:2:
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:534: error: use of enum `EmfPlusRecordType' without previous declaration
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:548: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:548: error: enumerator value for `WmfRecordTypeSetBkColor' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:549: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:549: error: enumerator value for `WmfRecordTypeSetBkMode' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:550: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:550: error: enumerator value for `WmfRecordTypeSetMapMode' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:551: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:551: error: enumerator value for `WmfRecordTypeSetROP2' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:552: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:552: error: enumerator value for `WmfRecordTypeSetRelAbs' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:553: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:553: error: enumerator value for `WmfRecordTypeSetPolyFillMode' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:554: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:554: error: enumerator value for `WmfRecordTypeSetStretchBltMode' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:555: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:555: error: enumerator value for `WmfRecordTypeSetTextCharExtra' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:556: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:556: error: enumerator value for `WmfRecordTypeSetTextColor' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:557: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:557: error: enumerator value for `WmfRecordTypeSetTextJustification' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:558: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:558: error: enumerator value for `WmfRecordTypeSetWindowOrg' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:559: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:559: error: enumerator value for `WmfRecordTypeSetWindowExt' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:560: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:560: error: enumerator value for `WmfRecordTypeSetViewportOrg' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:561: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:561: error: enumerator value for `WmfRecordTypeSetViewportExt' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:562: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:562: error: enumerator value for `WmfRecordTypeOffsetWindowOrg' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:563: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:543: error: forward declaration of `enum Gdiplus::EmfPlusRecordType'
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:563: error: enumerator value for `WmfRecordTypeScaleWindowExt' not integer constant
C:/Programme/CodeBlocks/include/gdi+/GdiplusEnums.h:564: error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'
Process terminated with status 1 (0 minutes, 3 seconds)
I just includes the Gdiplus.h
#include
But what to do?
|
|
|
|
 |
|
 |
Hi All,
I am using GdiPlus library for setting up the compression of JPEG image. The code snippet is similar to that provided in MSDN.
encoderParameters.Count = 1;
encoderParameters.Parameter[0].Guid = EncoderQuality;
encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
encoderParameters.Parameter[0].NumberOfValues = 1;
// Save the image as a JPEG with quality level 0.
quality = 0;
encoderParameters.Parameter[0].Value = &quality;
stat = image->Save(L"Shapes001.jpg", &encoderClsid, &encoderParameters);
if(stat == Ok)
wprintf(L"%s saved successfully.\n", L"Shapes001.jpg");
else
wprintf(L"%d Attempt to save %s failed.\n", stat, L"Shapes001.jpg");
When I set the encoderParameters.Parameter[0].Guid = EncoderQuality; I get Linker error saying that
gdiplus.lib(imagingguds.obj) : fatal error LNK1103: debugging information corrupt; recompile module. Surprisingly I get this only when I build debug version. It works fine in release version.
Thanks in advance.
|
|
|
|
 |
|
 |
OK! I tried replacing the GdiPlus.lib and it worked.
|
|
|
|
 |
|
 |
gdiplus.lib(imagingguds.obj) : fatal error LNK1103: debugging information corrupt; recompile module
Error executing link.exe.
Thats my error. But if replacing GdiPlus.lib is the answer, how do I do it? Delete the old one and recompile and create a new one? Can you walk me through this one, I'm new to VC++.
Do forgive my ignorance.
|
|
|
|
 |
|
 |
Excuse me...
Can you give me a link for download a version of your Microsoft SDK..
Thanks, and sorry for my english..
|
|
|
|
 |
|
 |
When I compile I get following errors:
--------------------Configuration: GDITry - Win32 Debug--------------------
Compiling...
Main.cpp
c:\program files\microsoft visual studio\vc98\include\gdiplusenums.h(29) : error C2146: syntax error : missing ';' before identifier 'GraphicsState'
c:\program files\microsoft visual studio\vc98\include\gdiplusenums.h(29) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Main.obj - 2 error(s), 0 warning(s)
How can I fix this?
|
|
|
|
 |
|
 |
Include windows.h before including gdiplus.h. Also using namespace gdiplus should be used.
#include
#include
using namespace Gdiplus;
-- modified at 2:23 Monday 17th July, 2006
|
|
|
|
 |
|
 |
Is there any new version of GDI+ other than version 1.0 ?
|
|
|
|
 |
|
 |
I get some errors when i try to compile/build my project. The errors look like this:
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(32) : error C2065: 'ULONG_PTR' : undeclared identifier
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(32) : error C2065: 'token' : undeclared identifier
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(32) : error C2165: 'left-side modifier' : cannot modify pointers to data
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(32) : error C2071: 'NotificationHookProc' : illegal storage class
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(33) : error C2146: syntax error : missing ')' before identifier 'token'
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(33) : error C2165: 'left-side modifier' : cannot modify pointers to data
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(33) : error C2071: 'NotificationUnhookProc' : illegal storage class
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(33) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(86) : error C2059: syntax error : 'const'
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(95) : error C2146: syntax error : missing ')' before identifier 'token'
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(95) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(95) : error C2182: 'GdiplusShutdown' : illegal use of type 'void'
c:\program files\microsoft visual studio\gdiplusfiles\gdiplusinit.h(95) : error C2059: syntax error : ')'
I tryed everything presented below but it didn't work. Can anyone please help me? Thanks.
|
|
|
|
 |
|
 |
This article is a load of crap. Picking just the GDI+ files out of the Platform SDK simply won't work. You need to download the whole SDK.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
 |
|
 |
Another hint for getting gdiplus up and running when you are getting compiler errors on a VC7 Win32 project is to undefine or comment out WIN32_LEAN_AND_MEAN in stdafx.h.
tterb45
|
|
|
|
 |
|
 |
when i was using windows.h in console application,I too experienced same errors.so,i used stdafx.h instead of windows.h before gdiplus.h.
|
|
|
|
 |
|
 |
Make sure the SDK includes come before the VC includes in Tools->Options->Directories.
|
|
|
|
 |
|
 |
has solved these mistakes? could help?
|
|
|
|
 |
|
 |
I followed the steps given by you to use Gdiplus library in Windows platform (other than XP). 102 errors occured when I tried to compile the file.
Also the following warning appeared,
"anachronism used : modifiers on data are ignored"
and the corresponding line was,
"extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);"
Could you sort out this problem?
Thanks.
|
|
|
|
 |
|
 |
Hi
These are my first steps with GDI+. But I can't set it up to work properly.
I have installed the latest PSDK.
#include "stdafx.h"
#include gdiplus.h
using namespace Gdiplus;
#pragma comment(lib,"GdiPlus.lib")
...
But I get 102 compile errors beginning with:
WinMain.cpp
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2501: 'MIDL_INTERFACE' : Fehlende Speicherklasse oder Typbezeichner
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2440: 'initializing' : 'char [37]' kann nicht in 'int' konvertiert werden
Diese Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2146: Syntaxfehler : Fehlendes ';' vor Bezeichner 'IImageBytes'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2501: 'IImageBytes' : Fehlende Speicherklasse oder Typbezeichner
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2239: Unerwartetes Token ':' nach der Deklaration von 'IImageBytes'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2059: Syntaxfehler : 'public'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(246) : error C2146: Syntaxfehler : Fehlendes ';' vor Bezeichner 'id'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(246) : error C2501: 'PROPID' : Fehlende Speicherklasse oder Typbezeichner
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(246) : error C2501: 'id' : Fehlende Speicherklasse oder Typbezeichner
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(384) : error C2629: 'class Gdiplus::Image (' unerwartet
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(384) : error C2238: Unerwartete(s) Token vor ';'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(395) : error C2061: Syntaxfehler : Bezeichner 'IStream'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(405) : error C2061: Syntaxfehler : Bezeichner 'IStream'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(443) : error C2061: Syntaxfehler : Bezeichner 'PROPID'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(444) : error C2061: Syntaxfehler : Bezeichner 'PROPID'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(445) : error C2061: Syntaxfehler : Bezeichner 'PROPID'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(453) : error C2061: Syntaxfehler : Bezeichner 'PROPID'
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(499) : error C2629: 'class Gdiplus::Bitmap (' unerwartet
C:\PROGRAMME\MICROSOFT SDK\INCLUDE\GdiplusHeaders.h(499) : error C2238: Unerwartete(s) Token vor ';'
...
Can you explain why?
Thanks in advance
Greg
|
|
|
|
 |
|
 |
Remove the LEAN_AND_MEAN definition from stdafx.h
Worked for me.
|
|
|
|
 |
|
 |
Removing WIN32_LEAN_AND_MEAN worked for me too. Took me ages to find this hint via google, it should be called out a lot easier.
|
|
|
|
 |
|
 |
I found when trying to work with GDI+ and the MFC I had to add #include <afxdisp.h> (MFC Automation classes, I think) to stdafx.h before #include <gdiplus.h> to avoid these errors. I am not sure what part(s) of this header are actually necessary.
|
|
|
|
 |
|
 |
Hi,
thx for the files,
but when I compile a gdi plus sample program,
I get the following errors:
1. Missing declaration of ULONG_PTR, I included in the stdafx.h in front of the #include "gdiplus.h" the following line:
typedef unsigned __int64 ULONG_PTR;
2. When I compile my program, I get a LNK2001 error, even if I set the correct path to the gdiplus.lib in the linker tab of my project options:
LNK2001: Unresolved external symbol _GdiplusShutdown, it is defined in GdiPlusInit.h as extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
What files are still needed to avoid this linker error ??
Thx in advance,
Michael Kuelshammer
|
|
|
|
 |
|
 |
Michael et al,
I had the same errors and problems as you guys . The key to finding the solution to your problem is in the above article when CodeMaze says: "but don't blame me, i never tried it this way, i just installed SDK and took the GDI+- files out of the propriate folders" and that is indeed what you have to do, install the whole SDK (I used the November 2001 one) it comes full of goodies that you need to get this gdi code to compile and link properly. You don't even have to typedef ULONG_PTR yourself.
Here is what I did in Visual Studio 6 after I installed the Platform SDK:
Project settings > C/C++ > Preprocessor > Additional include directories:
D:\Program Files\Microsoft SDK\Include
Project settings > Link > Input > Object/Library modules:
gdiplus.lib
Project settings > Link > Input > Additional library path:
D:\Program Files\Microsoft SDK\lib
Tools > Options > Directories > Include files
add:
D:\PROGRAM FILES\MICROSOFT SDK\INCLUDE
Tools > Options > Directories > Library files
add:
D:\PROGRAM FILES\MICROSOFT SDK\LIB
Don't use quotation marks for directories because Visual Studio is clever enough (this time ). Substitute "D:\Program Files\Microsoft SDK\" for your own MS SDK directory. Hope this works for you.
Hidde Wallaart
software engineer
www.leo-em.co.uk
|
|
|
|
 |