Ming_Lei Posted August 18, 2005 Posted August 18, 2005 I created a C++ class library, and I try to use malloc() and memcpy(), but I got the linkage error. I used the following line of code: unsigned char* newBuffer = (unsigned char*)malloc(size); ...... And I got the following linkage errors: Class error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3*****FYAXPAX@Z) Class error LNK2001: unresolved external symbol "void * __cdecl malloc(unsigned int)" (?malloc@*****J0YAPAXI@Z) Class error LNK2001: unresolved external symbol "void * __cdecl memcpy(void *,void const *,unsigned int)" (?memcpy@*****J0YAPAXPAXPBXI@Z) Does anyone know what went wrong? I have include 'malloc.h' header file. Thanks! :) Quote
HJB417 Posted August 20, 2005 Posted August 20, 2005 did you include <stdlib.h> and <malloc.h>? Quote
Ming_Lei Posted August 22, 2005 Author Posted August 22, 2005 Yes, I did include that two header files. What do you think is the problem. Is that memory functions can not be used in .Net library? Thanks. :confused: Quote
Administrators PlausiblyDamp Posted August 26, 2005 Administrators Posted August 26, 2005 IIRC the problem is down to C++'s name mangling - can you declare the functions as extern "C" and see if that fixes the problem. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.