I'm trying to compile a 3rd party program used for solid-state chemistry that calculates pore characteristics of an input material. The program was written between 2000 and 2006, so I believe the problem is that the headers used are outdated, but I'm not terribly computer savvy (and a complete Linux novice), so I'm not sure what's going on.
I'm running Ubuntu 11.10, 64 bit.
The program comes with an install script and all necessary .c and .cpp files
The install script is as follows:
g++ solvopt.cpp psd.cpp -o psd -O3
I open a terminal and type
./install
(which just contains the line above). I get the following string of errors:
user@ubuntu:~/Desktop/PSD Solve$ ./install
solvopt.cpp: In function �double solvopt(short unsigned int, double*, double (*)(double*), double (*)(double*, double*), double*, double (*)(double*), double (*)(double*, double*))':
solvopt.cpp:337:39: warning: deprecated conversion from string constant to �char*' [-Wwrite-strings]
solvopt.cpp:618:35: warning: deprecated conversion from string constant to �char*' [-Wwrite-strings]
solvopt.cpp:633:47: warning: deprecated conversion from string constant to �char*' [-Wwrite-strings]
solvopt.cpp:640:59: warning: format not a string literal and no format arguments [-Wformat-security]
solvopt.cpp:720:31: warning: deprecated conversion from string constant to �char*' [-Wwrite-strings]
psd.cpp: In function �int main(int, char**)':
psd.cpp:351:48: error: �strcmp' was not declared in this scope
psd.cpp:289:32: warning: ignoring return value of �int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
psd.cpp:290:45: warning: ignoring return value of �int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
psd.cpp:296:103: warning: ignoring return value of �int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
psd.cpp:339:84: warning: ignoring return value of �int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
user@ubuntu:~/Desktop/PSD Solve$
I'm just at a loss as to what to do. I fiddled around with changing the header files, but get more or less the same errors. The headers for the relevant files are included below:
//psd.cpp
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "gettime.c"
#include "solvopt.h"
#include "ran_nr.cpp"
#define big_no 1000.0
#define PI 3.141592654
#define MAX_TYPE 120
using namespace std;
long nearest(double x)
{
[etc.]
//gettime.c
#include <sys/time.h>
//#include <time.h>
int gettime(double *sec)
{
/* extern int gettimeofday(); */
struct timeval t;
struct timezone tz;
int stat;
stat = gettimeofday(&t, &tz);
*sec = (double)(t.tv_sec + t.tv_usec/1000000.0);
return(stat);
}
//solvopt.cpp
#include <stdlib.h>
#include <math.h> /* NEEDED FOR MATH MACROS. REMOVE, IF DEFINED ELSEWHERE */
#include <stdio.h>
#include <malloc.h>
#define errmes "\nSolvOpt error:"
#define wrnmes "\nSolvOpt warning:"
#define error2 "\nArgument X has to be a vector of dimension > 1."
#define error32 "\nFunction equals infinity at the point."
#define error42 "\nGradient equals infinity at the starting point."
#define error43 "\nGradient equals zero at the starting point."
#define error52 "\n<func> returns infinite value at the point."
#define error62 "\n<gradc> returns infinite vector at the point."
#define error63 "\n<gradc> returns zero vector at an infeasible point."
#define error5 "\nFunction is unbounded."
[etc.]
I would also be happy to provide any more information you need to solve the problem, including emailing or posting the entire program (it's pretty long). The link to the program is here (replace underscores with appropriate / or . or :, since it won't let me post URLs as a first-time poster):
http___supriyo_net_research_psd_psd_htm
I appreciate any help or guidance you can provide. Thanks!
motrax