?
Solved

can someone tell me where this comes from?

Posted on 2003-03-30
6
Medium Priority
?
549 Views
Last Modified: 2011-10-03
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!
ken
0
Comment
Question by:kencj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:Hermetic
ID: 8236616
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.
0
 
LVL 2

Accepted Solution

by:
Francoz earned 90 total points
ID: 8236638
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

fun(33.44).

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.

mk:@MSITStore:F:\Disk%202\vccore.chm::/html/lnk2001.htm
0
 

Expert Comment

by:kartik
ID: 8236932
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:Salte
ID: 8237165
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.

Alf
0
 

Expert Comment

by:captnoord
ID: 8237170
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
0
 

Author Comment

by:kencj
ID: 8238426
yeap. that was my problem. thanks
ken
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question