Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I create a dynamic library . I use malloc function in that dynamic library function..

I use free function in the main function..

But it produce the error..

inking...
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/staticmain.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.


What i want to do now.

Please guide me.

Thanks in Advance.
Posted
Updated 5-Jul-11 19:52pm
v2
Comments
Sergey Alexandrovich Kryukov 6-Jul-11 2:14am    
I answered, but if you cannot fix it you will have to post a relevant piece of code.
--SA

Apparently, you tried to re-define malloc somewhere. Find it in your code and exterminate. Do you know the difference between definition and declaration? C++ allows several declarations of the same thing; including is based on this rule, but multiple definitions will run into a link-time error like the one you show.

—SA
 
Share this answer
 
Comments
Joan M 6-Jul-11 2:15am    
As always correct... 5.
Sergey Alexandrovich Kryukov 6-Jul-11 2:17am    
Thank you, Joan.
--SA
Apparently, you are using different runtime libraries. See this[^] article
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 6-Jul-11 15:18pm    
Could be, too. My 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900