Compiling error xmrqmin.cpp in C++


ca2004
09-16-2010, 12:58 PM
Hi everyone

I am compiling the xmrqmin.cpp example to do a fitting. So, when I try to compile the example in linux, appear a following error:

In file included from nr_meu.h:7,
from xmrqmin.cpp:5:
nrutil_nr.h: In function ‘void NR::nrerror(std::string)’:
nrutil_nr.h:56: error: ‘exit’ was not declared in this scope


and into of the nrutil_nr.h file, the line 56 corresponds to:

namespace NR {
inline void nrerror(const string error_text)
// Numerical Recipes standard error handler
{
cerr << "Numerical Recipes run-time error..." << endl;

cerr << error_text << endl;
cerr << "...now exiting to system..." << endl;
exit(1);
}
}

I don't know what is causing the error or if something is missing?

I would like your help.

Thanks,

Manuel

davekw7x
09-17-2010, 12:51 PM
I am compiling the xmrqmin.cpp
This is for Numerical Recipes C++ (Version 2), right?

Well...

I have no problem compiling with compiling with compiler from GNU, Borland, and Microsoft on my Windows XP platform and with GNU compilers on my various Linux workstations.

So...

1. What version of operating system are you using?

2. What vendor and what version compiler are you using? How are you compiling (Command line or what?) Can you show the command line that is actually performing the compilation?

3. What is nr_meu.h? Where did you get it? How does it enter the compilation process? What is in it? It is not part of my NR distribution.


Regards,

Dave

ca2004
09-20-2010, 08:37 AM
Hi Dave,


This is for Numerical Recipes C++ (Version 2), right?

yes, it is Numerical Recipes in C++, Second Edition, final ver. 2.11

Well...

I have no problem compiling with compiling with compiler from GNU, Borland, and Microsoft on my Windows XP platform and with GNU compilers on my various Linux workstations.

So...

1. What version of operating system are you using?
Well, I am using Linux, fedora 12 and in this operating system I am trying to compile the program.

2. What vendor and what version compiler are you using? How are you compiling (Command line or what?) Can you show the command line that is actually performing the compilation?
I use the version compiler g++ based in gcc, the g++ version is g++ (GCC) 4.4.4 20100630 (Red Hat 4.4.4-10)

I have in the same folder all the neccesary files to compile and I try to compile on the following way:

g++ -o exec xmrqmin.cpp

and appears the error:

In file included from nr_meu.h:7,
from xmrqmin.cpp:5:
nrutil_nr.h: In function ‘void NR::nrerror(std::string)’:
nrutil_nr.h:56: error: ‘exit’ was not declared in this scope

3. What is nr_meu.h? Where did you get it? How does it enter the compilation process? What is in it? It is not part of my NR distribution.

nr_meu.h is a modified file from nr.h containing only the varibles and functions used in covsrt.cpp, gasdev.cpp, mrqmin.cpp, ran1.cpp, fgauss.cpp, gaussj.cpp, xmrqmin.cpp, fit.cpp, mrqcof.cpp these files are necessary to do the fitting.


Τhanks you so much for your attention and help

Regards,
Manuel