On Windows XP SP3 I get this error while compiling:
Make error line 299: problem compiling: src/extension/internal/emf-win32-inout.cpp: In member function 'virtual SPDocument* Inkscape::Extension::Internal::EmfWin32::open(Inkscape::Extension::Input*, const gchar*)': src/extension/internal/emf-win32-inout.cpp:2356: error: invalid conversion from 'int (*)(HDC__*, HANDLETABLE*, const ENHMETARECORD*, int, LPARAM)' to 'int (*)(HDC__*, HANDLETABLE*, ENHMETARECORD*, int, LPARAM)' src/extension/internal/emf-win32-inout.cpp:2356: error: initializing argument 3 of 'BOOL EnumEnhMetaFile(HDC__*, HENHMETAFILE__*, int (*)(HDC__*, HANDLETABLE*, ENHMETARECORD*, int, LPARAM), void*, const RECT*)'
Of course, changing the definition:
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *lpEMFR, int /*nObj*/, LPARAM lpData)
into
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD *lpEMFR, int /*nObj*/, LPARAM lpData)
(taking away the 'const') fixed the problem but I'm not sure this is what was intended.
Regards Luca
LucaDC wrote:
On Windows XP SP3 I get this error while compiling: ... Of course, changing the definition:
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *lpEMFR, int /*nObj*/, LPARAM lpData)
into
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD *lpEMFR, int /*nObj*/, LPARAM lpData)
(taking away the 'const') fixed the problem but I'm not sure this is what was intended.
Interesting. I just encountered the opposite, and thus added the const, as that also agrees with Microsoft's documentation. Also, I figured that even if this was different in older versions (I'm using TDM's GCC 4.5) it should be safe to hand it a function that takes a const parameter...
I've added a reinterpret_cast to shut gcc up about this (now in bzr). (If anyone has a more elegant solution they're welcome to implement it.)
Jasper van de Gronde wrote:
Interesting. I just encountered the opposite, and thus added the const, as that also agrees with Microsoft's documentation. Also, I figured that even if this was different in older versions (I'm using TDM's GCC 4.5) it should be safe to hand it a function that takes a const parameter...
Well, if you want to declare the parameter being const then you should write:
ENHMETARECORD * const lpEMFR
which is a const pointer to a non const ENHMETARECORD object, otherwise:
const ENHMETARECORD* lpEMFR or (which is the same) ENHMETARECORD const * lpEMFR
is a non const pointer to a const ENHMETARECORD object, and you can't pass a const pointer to it (being the ENHMETARECORD object const or not).
Regards. Luca
LucaDC wrote:
Jasper van de Gronde wrote:
Interesting. I just encountered the opposite, and thus added the const, as that also agrees with Microsoft's documentation. Also, I figured that even if this was different in older versions (I'm using TDM's GCC 4.5) it should be safe to hand it a function that takes a const parameter...
Well, if you want to declare the parameter being const then you should write:
Very observant :) I didn't express myself carefully enough. The parameter shouldn't be const, but rather the object being pointed to. (In other words: I coded it right, but worded it wrong.)
2010/8/4 LucaDC <dicappello@...2144...>:
On Windows XP SP3 I get this error while compiling:
Make error line 299: problem compiling: src/extension/internal/emf-win32-inout.cpp: In member function 'virtual SPDocument* Inkscape::Extension::Internal::EmfWin32::open(Inkscape::Extension::Input*, const gchar*)': src/extension/internal/emf-win32-inout.cpp:2356: error: invalid conversion from 'int (*)(HDC__*, HANDLETABLE*, const ENHMETARECORD*, int, LPARAM)' to 'int (*)(HDC__*, HANDLETABLE*, ENHMETARECORD*, int, LPARAM)' src/extension/internal/emf-win32-inout.cpp:2356: error: initializing argument 3 of 'BOOL EnumEnhMetaFile(HDC__*, HENHMETAFILE__*, int (*)(HDC__*, HANDLETABLE*, ENHMETARECORD*, int, LPARAM), void*, const RECT*)'
I think what we are observing is that the definitions of the ENHMFENUMPROC type for 64-bit versions of Windows do not match the one for 32-bit versions. If you leave out the const, it doesn't compile on 64-bit systems. Probably a mistake in the Win32 API headers from MinGW.
For now a cast is OK.
Regards, Krzysztof
On 4/8/10 18:56, Krzysztof Kosiński wrote:
2010/8/4 LucaDC <dicappello@...2144...>:
On Windows XP SP3 I get this error while compiling: (...) Of course, changing the definition:
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *lpEMFR, int /*nObj*/, LPARAM lpData)
into
myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD *lpEMFR, int /*nObj*/, LPARAM lpData)
(taking away the 'const') fixed the problem but I'm not sure this is what was intended.
tracked in Bug #594528 “Compile error for emf-win32-inout.cpp under Windows”: https://bugs.launchpad.net/inkscape/+bug/594528
~suv
participants (4)
-
Jasper van de Gronde
-
Krzysztof Kosiński
-
LucaDC
-
~suv