简体   繁体   English

C,Cygwin和编译drand和srand

[英]C, Cygwin, and compiling drand and srand

I have a C code which I am trying to compile in Cygwin and which contains both the drand() and srand() functions. 我有一个试图在Cygwin中编译的C代码,其中包含drand()srand()函数。 I had Windows Vista with Cygwin installed and the code seemed to comile fine, but my computer broke and I had to get a new one. 我安装了Cygwin的Windows Vista,并且代码似乎可以正常编译,但是我的电脑坏了,我必须购买新的。 The new computer has Windows 7 64-bit version. 新计算机具有Windows 7 64位版本。 I had a few issues downloading Cygwin but finally managed to do it by only selecting a few packages and then have been trying to get the rest that I need. 我在下载Cygwin时遇到了一些问题,但最终只选择了一些软件包就设法做到了,然后一直在尝试获取我需要的其余部分。 The problem is I don't have the help I had installing it on my other computer so I don't know which packages I actually need, so I have just been guessing (all the gcc ones) but I mustn't have the one I need for srand and drand to work. 问题是我没有在其他计算机上安装它的帮助,所以我不知道我实际需要的软件包,所以我一直在猜测(所有gcc软件包),但我一定没有我需要干劲儿才能上班。 If anyone could point me in the right direction, and also possibly just let me know which packages I need to compile C so I can check I have them all that would be great. 如果有人可以指出正确的方向,也可能只是让我知道我需要编译哪个程序包,那么我可以检查一下是否拥有它们,这些都很棒。

Thanks a lot in advance for any help. 提前非常感谢您的帮助。

Sorry, that was a lot of words! 抱歉,这句话很多!

Kaytiana 凯蒂亚娜

srand() and drand() functions are part of the <stdlib.h> library and should be included with the gcc-core cygwin package. srand()drand()函数是<stdlib.h>库的一部分,应包含在gcc-core cygwin软件包中。 If no, then I think it will be an issue with cygwin 64 bit packages or the OS. 如果没有,那么我认为这将是cygwin 64位软件包或OS的问题。 Since you mentioned you had problems installing, I am assuming something went wrong on the process. 既然您提到您在安装时遇到问题,我假设该过程出现了问题。

drand is not guaranteed to be part of the C standard library. 不保证drand会成为C标准库的一部分。 That being said, I would install all of the relevant stdlib and gcc libraries first. 话虽如此,我将首先安装所有相关的stdlib和gcc库。 I can't imagine a separate drand library existing. 我无法想象存在一个单独的drand库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM