JiiPee
2015-09-11 08:36:55 UTC
I have two projects and the other one is MFC. I want to include a cpp
and h files from the first project to the second. Two projects are in a
totally different folders. I though (and have done it before) that I can
just easily add files to the second project from the first project
location, but I do get this link error:
1>uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
new(unsigned __int64)" (??***@YAPEAX_K@Z) already defined in
LIBCMT.lib(new_scalar.obj)
1>uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void *)" (??***@YAXPEAX@Z) already defined in
LIBCMT.lib(delete_scalar.obj)
1>fatal error LNK1169: one or more multiply defined symbols found
The funny thing is that it only happens if the files are in a folder
which is on a same level as the second solution folder, or further. But
if I move the folder inside the second solution folder and then add the
files everything works. Also it does not matter what is the content of
the files! Even if the cpp/h files are totally empty I still get this
error, which is strange. Does including files only work if they are
inside the solution folder ... I cannot include files from another
folder on my computer?
One more thing: if I change the project to "use shared MFC library" ,
then it compiles. I also tried to play around with "runtime library "
setting (\MD, \MT) but could not get working.
With static MFC linking I cannot take files from another location on my
computer?
thank you
and h files from the first project to the second. Two projects are in a
totally different folders. I though (and have done it before) that I can
just easily add files to the second project from the first project
location, but I do get this link error:
1>uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
new(unsigned __int64)" (??***@YAPEAX_K@Z) already defined in
LIBCMT.lib(new_scalar.obj)
1>uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void *)" (??***@YAXPEAX@Z) already defined in
LIBCMT.lib(delete_scalar.obj)
1>fatal error LNK1169: one or more multiply defined symbols found
The funny thing is that it only happens if the files are in a folder
which is on a same level as the second solution folder, or further. But
if I move the folder inside the second solution folder and then add the
files everything works. Also it does not matter what is the content of
the files! Even if the cpp/h files are totally empty I still get this
error, which is strange. Does including files only work if they are
inside the solution folder ... I cannot include files from another
folder on my computer?
One more thing: if I change the project to "use shared MFC library" ,
then it compiles. I also tried to play around with "runtime library "
setting (\MD, \MT) but could not get working.
With static MFC linking I cannot take files from another location on my
computer?
thank you