⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_26025.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:26025 发表者:titany 发表日期:2002-12-27 20:36:27
<br>主题:碰到一个书上的例程调试不过去,请帮看看,谢谢!
<br>内容:Linking...<BR>Text1.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl random(void)" (?random@@YAIXZ)<BR>Debug/Text1.exe : fatal error LNK1120: 1 unresolved externals<BR>Error executing link.exe.<BR><BR>Text1.exe - 2 error(s), 0 warning(s)//链接时出错<BR><BR>static unsigned int r;<BR>randam(void)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;r=(r*123+59)%65536;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return (r);<BR>}<BR>unsigned random_start(unsigned int seed)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;r=seed;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return r;//这句我自己加的<BR>}<BR>#include &lt;iostream.h&gt;<BR>int main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned int random();//自己加上这句后编译才成功,但链接出错了<BR>&nbsp;&nbsp;&nbsp;&nbsp;int i,n;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;"Input the number seed:";<BR>&nbsp;&nbsp;&nbsp;&nbsp;cin&gt;&gt;n;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;"\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;random_start(n);<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(i=1;i&lt;=10;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;random()&lt;&lt;" ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<BR>}<BR><BR>2002-12-27 22:23:13

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -