Author Topic: Problem trying to build project  (Read 16482 times)

Offline Wicksmacker

  • Single posting newcomer
  • *
  • Posts: 3
Problem trying to build project
« on: November 03, 2008, 07:38:49 pm »
Hello, I had my project working before I reformat.
Now I get the following errors:

Quote
mingw32-g++.exe: ..\..\..\..\..\Program Files\Lua\5.1\lib\lua5.1.lib: No such file or directory
mingw32-g++.exe: ..\..\..\..\..\Program Files\Lua\5.1\lib\lua51.lib: No such file or directory

I added these files in the Linker settings tab of Build Options.
The files/directory are definitely there.
Why do I keep getting this error?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem trying to build project
« Reply #1 on: November 04, 2008, 12:14:13 pm »
Probably a problem with the ..\..\..\..\..  - easy to get those wrong.
I'd try adding the path to the linker's search directories, preferabbly as an absolute path stored in a user variable (that's what they're for). Then the library can be accessed by its name only, much more comfortably and failsafe.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Wicksmacker

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problem trying to build project
« Reply #2 on: November 07, 2008, 07:06:09 pm »
That fixed the problem.  Thank you very much, Thomas.

Offline Tupac

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problem trying to build project
« Reply #3 on: November 07, 2008, 10:28:39 pm »
I have a similar problem working a project in Code::Blocks ........ Do you have any suggestion?

These are the Error messages:

Quote
C:\project\metis-4.0\Lib\util.c           Undefined reference to "srand48"
C:\project\metis-4.0\Lib\initpart.c     Undefined reference to "drand48"

The Lib's paths have been previously declared in the Compiler and Linker Search Directories.
The files requested exist all of them: util.c & util.o - and - initpart.c & initpart.o
The standard library #include <stdlib.h> is declared inside of these C files (for using srand48 and drand48).

Previously the Cholmod and Metis math tools have been processed without errors using the Make sentence of the Cygwin tool.
But I see that these errors are referred to Standard Library functions!

Look foward any help.
Thanks.
« Last Edit: November 07, 2008, 10:30:13 pm by Tupac »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem trying to build project
« Reply #4 on: November 08, 2008, 05:30:36 pm »
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...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Tupac

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problem trying to build project
« Reply #5 on: November 08, 2008, 09:22:49 pm »
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...

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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem trying to build project
« Reply #6 on: November 10, 2008, 10:22:31 am »
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."