无法在Mac上编译C代码

时间:2017-03-31 08:47:13

标签: c macos compilation

我从ftp://ftp.cbcb.umd.edu/pub/software/glimmerhmm下载了GlimmerHMM 但是,我想在Mac OSX上运行它,所以在终端的/ sources文件夹中运行

gcc -o glimmerhmm glimmerhmm.c 

有人可以帮我一臂之力吗?提前谢谢!

现在所做的一切都会产生很多错误:

In file included from glimmerhmm.c:1:
./delcher.h:41:1: error: unknown type name 'template'
template <class DT>

^
./delcher.h:41:10: error: expected identifier or '('
template <class DT>
         ^

./delcher.h:43:1: error: unknown type name 'template'
template <class DT>

^
./delcher.h:43:10: error: expected identifier or '('
template <class DT>
         ^
./delcher.h:48:1: error: unknown type name 'template'
template <class DT>
^
./delcher.h:48:10: error: expected identifier or '('
template <class DT>
         ^
./delcher.h:55:1: error: unknown type name 'template'
template <class DT>
^
./delcher.h:55:10: error: expected identifier or '('
template <class DT>
         ^
./delcher.h:69:1: error: unknown type name 'template'
template <class DT>
^
./delcher.h:69:10: error: expected identifier or '('
template <class DT>
         ^
./delcher.h:82:1: error: unknown type name 'template'
template <class DT>
^
./delcher.h:82:10: error: expected identifier or '('
template <class DT>
         ^
In file included from glimmerhmm.c:2:
./graph.h:37:1: error: must use 'struct' tag to refer to type 'Site'
Site **graph (char *PData,long int PData_Len,char *TRAIN_DIR, long int *splicesiteno, char *ProtDomFi...
^
struct 
In file included from glimmerhmm.c:3:
./gene.h:18:35: error: expected ')'
int  Read_String  (FILE *, char * &, long int &, char [], int);
                                  ^
./gene.h:18:19: note: to match this '('
int  Read_String  (FILE *, char * &, long int &, char [], int);
                  ^
./gene.h:19:41: error: expected ')'
int  Read_Multi_String  (FILE *, char * &, long int &, char [], int,int);
                                        ^
./gene.h:19:25: note: to match this '('
int  Read_Multi_String  (FILE *, char * &, long int &, char [], int,int);
                        ^
glimmerhmm.c:11:3: error: must use 'struct' tag to refer to type 'exon'
  exon *predexon;
  ^
  struct 
glimmerhmm.c:12:3: error: must use 'struct' tag to refer to type 'List'
  List *link;
  ^
  struct 
glimmerhmm.c:16:15: error: must use 'struct' tag to refer to type 'List'
void freeList(List *L);
              ^
              struct 
glimmerhmm.c:18:21: error: must use 'struct' tag to refer to type 'Site'
long int printgenes(Site **Sites, long int ssno,int start, int stop, int ignore,int offset,int *offge...
                    ^
                    struct 
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

1 个答案:

答案 0 :(得分:0)

这是运行提供的makefile的结果

~/Downloads/Glimmerhmm/GlimmerHMM/sources$ make -f makefile
g++ -g -c glimmerhmm.c
glimmerhmm.c: In function ‘int main(int, char**)’:
glimmerhmm.c:128:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
     fprintf(stderr,"Done %d bp\n",proclen);
                                          ^
glimmerhmm.c: In function ‘long int printexon(List*, int*, int*, int*, long int, long int, long int, int*, long int, FILE*, char*, int, int*)’:
glimmerhmm.c:645:146: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:664:146: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:683:148: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:703:148: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:722:148: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:743:146: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:763:146: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
glimmerhmm.c:781:148: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long int’ [-Wformat=]
 nno,curexon->start+offset,curexon->stop+offset,curexon->stop-curexon->start+1);
                                                                              ^
g++ -g -c graph.c
graph.c: In function ‘Site** graph(char*, long int, char*, long int*, char*, long int, int, char*, int, int)’:
graph.c:1051:63: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
  fprintf(stderr,"Memory allocation for coding %d failure.\n",i);
                                                               ^
graph.c:1062:63: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
  fprintf(stderr,"Memory allocation for coding %d failure.\n",i);
                                                               ^
graph.c:1089:65: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
    fprintf(stderr,"Memory allocation for coding %d failure.\n",i);
                                                                 ^
graph.c:1233:93: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long int*’ [-Wformat=]
 ne,"%s %d %d %*s %*d %*d %f %e %*s",File_Name,&begdom,&enddom,&bitscore,&eval);
                                                                              ^
graph.c:1233:93: warning: format ‘%d’ expects argument of type ‘int*’, but argument 5 has type ‘long int*’ [-Wformat=]
graph.c:1233:93: warning: format ‘%e’ expects argument of type ‘float*’, but argument 7 has type ‘double*’ [-Wformat=]
graph.c:2085:63: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
  fprintf(stderr,"Memory allocation for coding %d failure.\n",i);
                                                               ^
g++ -g -c sites.c
g++ -g -c tree_util_prob.c
tree_util_prob.c: In function ‘tree_node* read_tree(char*)’:
tree_util_prob.c:64:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     error ("Decision Tree file can not be opened.");
                                                   ^
tree_util_prob.c:67:42: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     error("Decision tree invalid/absent.");
                                          ^
tree_util_prob.c:70:42: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     error("Decision tree invalid/absent.");
                                          ^
tree_util_prob.c: In function ‘tree_node* read_hp(FILE*)’:
tree_util_prob.c:192:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
  error("Invalid/Absent hyperplane equation.");
                                             ^
tree_util_prob.c:196:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
      error("Read-Hp: Invalid hyperplane equation.");
                                                   ^
tree_util_prob.c:198:66: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
      error("Read_Hp: Invalid coefficient index in decision tree.");
                                                                  ^
g++ -g -c util.c
util.c: In function ‘int* ivector(int, int)’:
util.c:84:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
   if (v==NULL) error("Ivector : Memory allocation failure.");
                                                            ^
util.c: In function ‘float* vector(int, int)’:
util.c:101:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
   if (v==NULL) error("Vector : Memory allocation failure.");
                                                           ^
util.c: In function ‘double* dvector(int, int)’:
util.c:118:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
   if (v==NULL) error("Dvector : Memory allocation failure.");
                                                            ^
g++ -g -o glimmerhmm glimmerhmm.o graph.o sites.o tree_util_prob.o util.o  -lm 

因此,即使移动到MAC,此代码也需要进行大量修改才能获得成功的编译/链接