PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Symbol redifination errors when using CFile

This could be a question more related to a general WinCE development forum but I'm posting it here first in the of chance that it's GapiDraw related. I find that if I use CFile (as defined in Afx.h) in my GapiDraw application, I get a bunch of linker errors due to symbol redefinitions.

Here are the error messages from eVC++

Code:
Linking...
uafxwced.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in coredll.lib(COREDLL.dll)
uafxwced.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in coredll.lib(COREDLL.dll)
uafxwced.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in coredll.lib(COREDLL.dll); second definition ignored
uafxwced.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in coredll.lib(COREDLL.dll); second definition ignored


Has anyone run across this problem? I tried it with a eVC++ generated project and it builds fine. Thanks.
I'm posting more info on this problem as I have not been able to find a solution thus far. What I'm trying to do is add file and/or database support to a GapiDraw application. I find that if I declare either a CFile object or a CCeDBDatabase object to a GapiDraw project I get the above linker errors. The reverse is also true. If I add a GapiDraw call into a project that uses CFile or CCeDBDatabase, I also get the linker errors. It seems that there is a symbol conflict between something that GapiDraw uses and something that is in core.dll? The solution is probably a compiler declaration that I am missing. I'm sure there are many GapiDraw applications out there that has file/database support. Has anyone run across a similiar problem? Better yet, is there a sample project that I can look at? Thanks!
I got around the problem by using FILE instead of CFile. Is GapiDraw not suppose to work with any of the MFC classes like CFile, CList, etc? I get the same error when I use CList. I can use an array instead of the more complex data structures, but I'd like to find out if I'm doing something wrong that is causing these errors. Thanks.
I haven't had a problem using MFC classes like CList and CFile with GapiDraw. One thing that may be causing issues is the order of your Libs in your library list. I always place GapiDraw first. This was a problem with DirectX back in an earlier version as well. You'd get tons of link errors that were purely a result of the linker binding to the lib later then it should.
Putting gd104.lib at the front of the list alone doesn't fix the problem but removing coredll.lib seems to do the trick. Thanks for the tip!!