User forums > General (but related to Code::Blocks)

Problem trying to build project

<< < (2/2)

Tupac:

--- Quote ---Not related to the previous problem, as in your case it's not a linker path that's wrong, but missing symbols, i.e. you're not linking the object file or library containing srand48 and drand48 at all.
I'm not sure if either Cygwin or MinGW support drand48 at all, though... so you might need to compile drand48.c or something...
--- End quote ---

Thank you Thomas. I appretiate your advices. I have to tell you that I'm far not an expert in C::B C++ language, but I'm trying, so I wonder if you could be more specific and detailed about how can I do this issues in my CB environment.

Particulary I have two questions:

1. How can I do link these libraries in my project (what symbols do you refer?), because I can see that the "util.o" and "initpart.o" files exist!

2. Of course maybe these files are not good compiled. I wonder if these "srand48" and "drand48" commands work in a Windows Vista environment?

I have read that these commands work only in Linux not in Windows, but it is hard to think that these Metis and Cholmod libraries for Windows (that I downloaded) included so obvious mistake.

I look foward your suggestions.
Thank you very much.

Tupac

thomas:
srand48/drand48 are part of the single Unix specification, so you're (almost) right. Linux is not Unix, but close enough :)
However, as it's only a library function, there is a chance that Cygwin includes it... MinGW pretty sure doesn't, I'm quite certain.

What you can do to get it working is to either replace drand48() with the normal rand() function (and similarly for srand()) via a #define hack, if you can afford having a lower quality random number generator, or you have to provide that missing function yourself.
Chances are that if whatever project you try to compile is cross-platform and it already includes a drand48.c file. If it doesn't, you can find an implementation via Koders or Google code search. Compile that file, and link it. In principle, you can use any PRNG function, as long as you keep the function's signature intact.

Navigation

[0] Message Index

[*] Previous page

Go to full version