Page 1 of 1

Odd Linker error...just a bit of help needed.

PostPosted: Sep 9, 2003 @ 5:25pm
by Codejoy
Okay I think I am just not following something 100% but i added a class from my old C++ program I had... and put it into a embedded visual C++ project. The class used some mfc stuff like CPoint, CList, and CRect...so I added in the various .h files for the class to work those were:

"afxwin.h"
"afxtempl.h"

These two things then get the new class to compile with my other project (keep in mind it was compiling and linking just fine before) but now even though it compiles I get the following linker errors:

--------------------Configuration: Simple - Win32 (WCE ARM) Release--------------------
Compiling...
Gesture.cpp
Linking...
uafxwce.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in coredll.lib(COREDLL.dll)
uafxwce.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in coredll.lib(COREDLL.dll)
uafxwce.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in coredll.lib(COREDLL.dll); second definition ignored
uafxwce.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in coredll.lib(COREDLL.dll); second definition ignored
Creating library ..\Bin/3dTest.lib and object ..\Bin/3dTest.exp
..\Bin/3dTest.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

3dTest.exe - 3 error(s), 2 warning(s)

I assume I have the wrong.h or the wrong .dll in the project, but I cannot figure out exactly whats going on...yes i know it says in coredll.lib but I do believe i need that in there...plus it puzzles me that the linker errors are on standard syntax stuff like new and delete.

So what piece of this puzzle am I missing? Any help would be greatly appreciated...I really hate linker errors sometimes..

PostPosted: Sep 9, 2003 @ 6:15pm
by angedelamort

libs

PostPosted: Sep 9, 2003 @ 6:21pm
by Codejoy
Well the only thing I changed to the project was added a .cpp and .h file that require the use of some other MFC functions, so in these new .cpp and .h files I added i had them incldue:

afxwin.h
-and-
afxtempl.h

So that this new .cpp and .h file I added to the project may compile, it does but I now get a linker error, so including the above .h files result in a linker error. I didnt touch what the default libs were in the project settings but the list that is there now is:

commctrl.lib
coredll.lib and
aygshell.lib

So that is why its odd that including the above afx*.h files now result in a linker error.

Strange

PostPosted: Sep 9, 2003 @ 7:05pm
by Pejo Software - Per

I thank thee.

PostPosted: Sep 9, 2003 @ 7:22pm
by Codejoy
Thanks a lot, i read the article, messed around with it and finally got it to work (i hope the code still compiles and runs now).

I thank you, kudos to those that can actually navigate the mother of the site that is MSDN.