ctipsy

Opening an old version of a C file


I need to install a program (tipsy) that is used to visualize galaxies simulation (my physics professor recommended it to me and he is using it too).

I tried to install it, I created the makefile but when I run it I get an error for the following piece of code:

framepoints(job)

char job[MAXCOMM] ;
{
    char command[MAXCOMM] ;
    char file_root[MAXCOMM] ;
    char particle_type[MAXCOMM] ;

    int box ;

    struct gas_particle *gp ;
    struct dark_particle *dp ;
    struct star_particle *sp ;

    double part_pos[2] ;
    int i,j,k ;

    char projection_type[MAXCOMM] ;

    if (sscanf(job,"%s %d %s %s",command,&box,
        particle_type,file_root) == 4) { 

       if(strcmp(particle_type,"star") != 0 &&
          strcmp(particle_type,"gas") != 0 &&
          strcmp(particle_type,"dark") != 0 &&
          strcmp(particle_type,"gasandstar") != 0 &&
          strcmp(particle_type,"darkandstar") != 0 &&
          strcmp(particle_type,"darkandgas") != 0 &&
          strcmp(particle_type,"all") != 0) {

              printf("<sorry, %s is not a particle option, %s>\n",
                     particle_type,title) ;
              return ;
}

The error says:

non-void function 'framepoints' should return a value

I understood that this return without any value is from versions before C89 but I don't know how to solve it. The code I need to run in order to install it is long so I can't modify it by hand (and also my professor told me it is working).


Solution

  • Change the line

    return;
    

    to

    return 0;
    

    or something like that to fix this problem. Optionally, pass the option

    -Wno-return-type
    

    to the compiler (if you are using clang, the default compiler on OS X) to make this not an error.