Problem compiling 3rd party g++ program


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem compiling 3rd party g++ program
# 1  
Old 03-08-2012
Problem compiling 3rd party g++ program

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:

Code:
g++ solvopt.cpp psd.cpp -o psd -O3

I open a terminal and type
Code:
./install

(which just contains the line above). I get the following string of errors:
Code:
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:
Code:
//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.]

Code:
//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);
}

Code:
//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
# 2  
Old 03-08-2012
Most of those are warnings and probably safe to ignore, but this one:

Code:
psd.cpp:351:48: error: ‘strcmp' was not declared in this scope

...is because they forgot to #include <string.h>

So:

Code:
//psd.cpp
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "gettime.c"
#include "solvopt.h"
#include "ran_nr.cpp"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

3rd party stress testing services

Hi all, bit of a forum newb here, so apologies if this has been covered else where, but I wonder if any of you has any experience with stress testing servers, specifically using 3rd party services. We run a very busy production system, and just haven't been able to simulate the user activity while... (1 Reply)
Discussion started by: dare99
1 Replies

2. UNIX for Beginners Questions & Answers

Identifying all the 3rd party software/executable files in RHEL 5.6

I have used yum list installed and rpm -qa commands. But these provide only the source packages, I want the specific software name. And how to identify any software that is installed without the yum or rpm package system. I tried compgen -c but it doesn't works with rhel5.6 (1 Reply)
Discussion started by: PrabhaPatra4567
1 Replies

3. Shell Programming and Scripting

No such file or directory for 3rd party software

I am trying to use the KiFMM3D software with my code. I am compiling code in C++ and everything looks fine but I am getting an "no such file or directory" error regarding the KiFMM3d code. The exact error message is : In file included from... (0 Replies)
Discussion started by: larry burns
0 Replies

4. Linux

Will installing LINUX mean reinstalling my 3rd party apps?

Hi all, Long time UNIX admin, first time LINUX user. So I'm finally at the last straw with Windows. I hate it. I've always hated it but the wife was scared of change so I kept it going. But Window's insistence on "protecting" me by preventing me access to certain areas created hours of work... (14 Replies)
Discussion started by: Korn0474
14 Replies

5. AIX

finding 3rd party Applications installed on AIX

Hi,. I want to know how to find out 3rd party application installed on aix, example Oracle database if it is installed on aix box it is not showing as installed using lslpp -l command Regards, Manoj (1 Reply)
Discussion started by: manoj.solaris
1 Replies

6. Programming

Problem compiling program

hi i am having a problem that when ever i use cc program_name.c to compile a program. an error occurs, showing cc not found. please help. (28 Replies)
Discussion started by: rochitsharma
28 Replies

7. Solaris

Findout 3rd party softwares in Linux/Solaris server

Hi all, how to find 3rd party softwares like Oracle,phpldapadmin,Citrix etc (other than packages) which are installed on a linux box. Please guide me to get this info'n on LINUX/SOLARIS. Thanks in advance, Uday (0 Replies)
Discussion started by: uday123
0 Replies

8. AIX

3rd Party Utilities to read Syslog

I'm new to UNIX / AIX and I'm trying to determine the best way to monitor the SYSLOG output generated from our RS6000. I apologize if there is another thread that already addresses this issue, I scanned the threads, but didn't see anything. Thanks in advance, Rosemary (0 Replies)
Discussion started by: ratrahan
0 Replies

9. Shell Programming and Scripting

How to pass variables to 3rd party unix menu?

Hello, I was wondering if it is possible to pass data to a unix driven 3rd party menu. Changing the code is out of the question. I have a menu with various options and I would like a ksh to execute the menu and input the required fields. For example. Main menu 1. Company Name 2. blah... (3 Replies)
Discussion started by: ctcuser
3 Replies

10. UNIX for Dummies Questions & Answers

root cron was override w/ 3rd party software

Hi Guys, I'm new in Unix Environment. Any Unix Guru around...I need help. My question is, is it possible that the root cron could be override with 3rd party software?How can it happen. Another thing, how the cron job works?, I mean how the Unix process the cron job , I don't have an idea... (2 Replies)
Discussion started by: kupal
2 Replies
Login or Register to Ask a Question