can someone tell me where this comes from?

error LNK2001: unresolved external symbol "int __cdecl Rand(void)" (?Rand@@YAHXZ)
i would like to know the nature of this error and how to go about it. don't have to be specific but what causes this error. i seem to have a few of them. thanks!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

typically this problem occurs whe you are missing or you aren't linking in the proper libraries (.lib) during your creation of the executable.  In your case, it seems you are failing to link a pretty standard library.
Probably you might've declared a function prototype but not implemented elsewhere. For example, in the .h file you've one declaration as follows.

int fun(float b);

But this function is not implemented anywhere and so doesnt've a body. But in some other .cpp file you're trying to access this function as


The linker will generate an error at this point because it couldnt find an apporpriate func body.

Check out the below link to get more information, if you've msdn access.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The problem occurs when you are linking with imrpoper lib. Try compiling the same program in a diff m/c. If it gets compiled there , whithout linking errors,then the lib files in your disk might be corrupted. Are you using MSDEV environment for this pgm? If so verify whether you have proper Service Pack installed or not.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

My guess is that you have had a mispelling somewhere...

You have declared:

int Rand();

but never linked in any file that defines that function. It is possible you really meant:

int rand();

which is a standard C library function. Note that casing IS significant in C++ and C, so rand() and Rand() are two different names.

It's possible that you've declared a function but delete it and fogot to delete the function prototype in the *.H file just be carefull whar you delete and how becouse it can (Edited by Computer101) up the whole program
greets Captnoord
kencjAuthor Commented:
yeap. that was my problem. thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.