Page 1 of 1

unresolved external thats not external???

Posted: Sat Nov 10, 2007 6:50 pm
by LordMage
I am trying to implement a memset function in my OS but when I compile I get

Code: Select all


error LNK2019: unresolved external symbol _memset referenced in function "void _stdcall memset(unsigned char *,unsigned char,int)"(?memset@@YGXPAEEH@Z)

what I don't understand is that memset is not an external function and it certainly doesn't call itself from inside the function. any ideas?

Posted: Sat Nov 10, 2007 8:41 pm
by frank
You are compiling C++ correct? The name mangling seems to suggest that. Try putting extern "C" before the definition and the prototype of memset. Also make sure that your not including any system libraries.

Posted: Sun Nov 11, 2007 4:47 am
by Combuster
it means that memset has a reference to _memset somewhere which is not implemented.

btw, is this Visual C ?

Posted: Tue Nov 13, 2007 6:38 am
by LordMage
Okay, first I have not included a memset anywhere except the prototype and the actual function declaration.

second yes this is Visual C++ and I am not using any system libraries, the only code in my project is code I have written. everything works just fine except memset thinks it should have an external definition.

in my string.cpp I have this line

Code: Select all


#include <system.h>

in my system.h I have this line

Code: Select all


#include <string.h>

in my string.h I have the prototype of memset and I think I just figured out the problem. I'll bet that if I put #include <string.h> in string.cpp and put extern memset in system.h then everything will work just fine. I will test later today, thanks for the push