mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2003-10-21, 19:23   #1
bad_source_bios
 
Oct 2003

58 Posts
Thumbs down namespace problem during build

Hi,

I'm trying to build the source code for Prime95, and get the following build errors, repeatedly, but it's all caused by the same thing:
c:\Documents and Settings\Jim\My Documents\GIMPS mersenne prime source code\source23\source\giants.c(1706): error C2668: 'sqrt' : ambiguous call to overloaded function
c:\Documents and Settings\Jim\My Documents\GIMPS mersenne prime source code\source23\source\commonb.c(1056): error C2668: 'pow' : ambiguous call to overloaded function
c:\Documents and Settings\Jim\My Documents\GIMPS mersenne prime source code\source23\source\commonb.c(1604): error C2668: 'log' : ambiguous call to overloaded function

... and so forth. These calls seem to be conflicting with functions in math.h

I tried doing a
#define sqrt std::sqrt

but that didn't work. Can anyone help me out here, please?
bad_source_bios is offline   Reply With Quote
Old 2003-10-22, 13:03   #2
dsouza123
 
dsouza123's Avatar
 
Sep 2002

12268 Posts
Default

What compiler are you using ?
dsouza123 is offline   Reply With Quote
Old 2003-10-22, 13:18   #3
bad_source_bios
 
Oct 2003

5 Posts
Default

I'm using M$ Visual Studio .NET 2003

If I knew from where these functions should be defined,
I would add a
namespace here_they_are {
}

but I don't
bad_source_bios is offline   Reply With Quote
Old 2003-11-02, 01:37   #4
Nebob
 
Sep 2002

10112 Posts
Default

The errors have nothing to do with namespaces. Where did you get that idea?

VS.NET 2003 adds "int" and "float" specific math routines to the CRT (previous releases only had "double" versions). As a result, the compiler can't figure out which one you want. Resolution: build with VS.NET 2002 or fix the code yourself by casting the return values.

Last fiddled with by Nebob on 2003-11-02 at 01:38
Nebob is offline   Reply With Quote
Old 2003-11-02, 02:50   #5
bad_source_bios
 
Oct 2003

5 Posts
Default

I was able to get past that problem by adding some float casts.

But now I get a pile of errors like:
Prime95 error LNK2005: "void __cdecl cdft(int,int,double *,int *,double *)" (?cdft@@YAXHHPANPAH0@Z) already defined in giants.obj

Were you able to get the version that downloads from this site to compile in MS VS .NET 2002?
bad_source_bios is offline   Reply With Quote
Old 2003-11-03, 00:05   #6
bad_source_bios
 
Oct 2003

5 Posts
Default

Any1? Any1? Can anybody build in VS .NET 2002? Prime95 said something about needing to compile the giants.c off by itself, and then linking to the .obj file. Has any1 been able to build this?
bad_source_bios is offline   Reply With Quote
Old 2003-12-03, 20:34   #7
bad_source_bios
 
Oct 2003

5 Posts
Default Nebob, you were right

Nebob: you had my problem pegged.



I think that my link error was due to the fact that I didn't start over from an early enough point. I deleted my unzipped directory, and did these things:

In stdafx.h, I added:
#define SECURITY_WIN32

What should I have defined this as, and if it depends, on what does it depend?

I added a ton of "double" casts, to sqrt, pow, and ceil.

Am I correct in inferring that this should run correctly in version 23 from your earlier post?
bad_source_bios is offline   Reply With Quote
Old 2003-12-03, 20:38   #8
Nebob
 
Sep 2002

1110 Posts
Default

The security setting doesn't really make a difference, since the security code isn't in the public source distribution. You'll notice your build always comes up with a residue of 0. (I think? Been a while)

The server still accepts these results, so yeah, it should run fine.
Nebob is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
build with MSVC 2010 problem Geek2600 Msieve 0 2018-02-12 13:37
[Patch] CPU affinity prompt problem in mprime Linux / OS X build Explorer09 Software 1 2017-03-01 02:34
New build with ECC ram PageFault Hardware 1 2012-08-23 03:44
New build PageFault Hardware 28 2011-09-19 07:15
build problem on x86_64 Prime95 GMP-ECM 21 2007-04-20 09:39

All times are UTC. The time now is 01:14.


Sat Jul 17 01:14:56 UTC 2021 up 49 days, 23:02, 1 user, load averages: 1.03, 1.07, 1.27

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.