xerces-c xmemory problem

Hi! I'm developing a c++ application using mfc and visual studio. My application needs an xml parser and I chose xerces. When I integrate mfc and xerces, I get a lot of XMemory.hpp compile errors.

I've gone through some posts and they say its due to the preprocessor directive visual studio uses in debug mode:

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

I'm using xerces-2.4.0 and visual studio .Net 2003. I've read that I should patch the xerces source code. I got the patch but I don't think I patched it properly. The script patches the XMemory.cpp and XMemory.hpp files. But only the first one gets properly patched. I'm using cygwin to patch.

I'm no expert programmer. If you have any solutions, I would really appreciate it if you could be detailed with it. Like, maybe you could tell me the exact commands to execute? I'm not even sure about how to patch. I've been to some tutorial sites and told me to do:

patch -p2 < patchfile.txt

I'm running this inside the xerces folder where the folder 'src' is. When running, I get this message from patch:

$ patch-p2 < patch.txt
missing header for unified diff at line 8 of patch
(Stripping trailing CRs from patch.)
can't find file to patch at input line 8
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
------------
| Index: XMemory.cpp
|====================================
| RCS file: /home/cvspublic/xml-xerces/c/src/xercesc/util/XMempry.cpp,v
| retrieving revision 1.7
| idff -u -r1.7 XMemory.cpp
|-- XMemory.cpp 14 Jul 2003 18:51:05 -0000 1.7
| +++ XMemory.cpp 22 Aug 2003 07:46:47 -0000
------------
file to patch: //here, I type the location of XMemory.cpp

After typing the location, I get:
Hunk #1 succeeded at line 111 with fuzz 2 (offset 28 lines).
...

then it tells me it also can't find the file. I do the same thing as above and get this message:

Hunk #1 succeeded at 105 with fuzz 2 (offset 12 lines).
patch unexpectedly ends in middle of line
Hunk #2 FAILED at 145.

I found the patch in <http://issues.apache.org/bugzilla/show_bug.cgi?id=22178>. It's in the last post by Alberto Massari dated 2003-08-22 07:54. Am I getting the file not found because I'm running the patch in the wrong directory? Or because I don't have the same directory structure? My xerces is in C:\xerces-c-src2_4_0.

Thanks! Its a long post. sorry
[2633 byte] By [paulr1984] at [2007-11-19 3:48:33]