2015-07-21 110 views
-1

自從幾個星期以來,我正在使用一款可與OS X Yosemite(版本10.10.3)一起使用的新Mac。我發現從源代碼安裝程序遇到了很多麻煩,爲什麼我已經將編譯器改爲例如gcc 4.2,4.7和4.9。此外,我「剔除」連接到叮噹聲,但這也會在編譯時產生錯誤。但是,在Mac OS X機器版本10.7.5上執行相同的操作也可以。在那裏,gcc版本4.2.1正在運行。GCC/G ++錯誤Mac OS X優勝美地

下面是一個例子錯誤信息,我得到輸入make命令行:

cc -O2 -c -o swat.o swat.c 
In file included from swat.c:25: 
./swat.h:85:35: warning: '/*' within block comment [-Wcomment] 
    /* int *maxstu_vec; NOT NEEDED /* array of length length + 1, used to hold row of scores, 
           ^
swat.c:29:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
compare_scores(entry1, entry2) 
^ 
swat.c:35:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
compare_z_scores(entry1, entry2) 
^ 
swat.c:42:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
compare_E_values(entry1, entry2) 
^ 
swat.c:49:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
main(argc,argv) 
^ 
swat.c:75:3: warning: implicit declaration of function 'get_parameters' is invalid in C99 [-Wimplicit-function-declaration] 
    get_parameters(argc, argv, "swat"); 
^
swat.c:85:3: warning: implicit declaration of function 'alloc_hist' is invalid in C99 [-Wimplicit-function-declaration] 
    alloc_hist(); 
^
swat.c:86:10: warning: implicit declaration of function 'get_next_file_entry' is invalid in C99 [-Wimplicit-function-declaration] 
    while (get_next_file_entry(qdb)) { 
     ^
swat.c:95:5: warning: implicit declaration of function 'notify' is invalid in C99 [-Wimplicit-function-declaration] 
    notify("Searching: "); 
    ^
swat.c:98:12: warning: implicit declaration of function 'append_seq_entry' is invalid in C99 [-Wimplicit-function-declaration] 
     s_entry = append_seq_entry(sdb); 
       ^
swat.c:110:2: warning: implicit declaration of function 'set_score' is invalid in C99 [-Wimplicit-function-declaration] 
     set_score(s_entry, score); 
     ^
swat.c:127:57: warning: implicit declaration of function 'get_seq_length' is invalid in C99 [-Wimplicit-function-declaration] 
     score = parameters->align(q_profile, get_seq(s_entry), get_seq_length(s_entry), 1, 0, 0, 0, 0, 0); 
                  ^
swat.c:146:5: warning: implicit declaration of function 'initialize_hist' is invalid in C99 [-Wimplicit-function-declaration] 
    initialize_hist(); 
    ^
swat.c:155:7: warning: implicit declaration of function 'update_hist' is invalid in C99 [-Wimplicit-function-declaration] 
     update_hist(score_entry, 0); 
    ^
swat.c:158:5: warning: implicit declaration of function 'process_hist' is invalid in C99 [-Wimplicit-function-declaration] 
    process_hist(); 
    ^
swat.c:172:2: warning: implicit declaration of function 'fit_log_n' is invalid in C99 [-Wimplicit-function-declaration] 
     fit_log_n(q_length); 
     ^
swat.c:175:4: warning: implicit declaration of function 'find_z' is invalid in C99 [-Wimplicit-function-declaration] 
      find_z(score_entry); 
     ^
swat.c:195:9: warning: implicit declaration of function 'reject_entry' is invalid in C99 [-Wimplicit-function-declaration] 
      if (!reject_entry(score_entry)) nz++; /* assumes Smith-Waterman */ 
      ^
swat.c:202:7: warning: implicit declaration of function 'new_est_lambda_K' is invalid in C99 [-Wimplicit-function-declaration] 
     new_est_lambda_K(q_length, score_entries, last_score_entry); 
    ^
swat.c:242:24: warning: '&&' within '||' [-Wlogical-op-parentheses] 
     if (parameters->use_n && score_entry >= score_entries + parameters->max_num_alignments 
      ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
swat.c:242:24: note: place parentheses around the '&&' expression to silence this warning 
     if (parameters->use_n && score_entry >= score_entries + parameters->max_num_alignments 
          ^
      (                    ) 
swat.c:243:24: warning: '&&' within '||' [-Wlogical-op-parentheses] 
     || parameters->use_z && score_entry->z < parameters->z_cutoff || !score_entry->score) 
     ~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
swat.c:243:24: note: place parentheses around the '&&' expression to silence this warning 
     || parameters->use_z && score_entry->z < parameters->z_cutoff || !score_entry->score) 
          ^
      (              ) 
swat.c:256:29: warning: data argument not used by format string [-Wformat-extra-args] 
       score_entry->score, score_entry->z, e_value, score_entry->E); 
           ^
swat.c:261:2: warning: implicit declaration of function 'print_alignment' is invalid in C99 [-Wimplicit-function-declaration] 
     print_alignment(q_profile); 
     ^
swat.c:266:65: warning: data argument not used by format string [-Wformat-extra-args] 
       get_id(seq_num), get_seq_length(seq_num), score_entry->score, score_entry->z); 
                      ^
swat.c:272:5: warning: implicit declaration of function 'free_profile' is invalid in C99 [-Wimplicit-function-declaration] 
    free_profile(q_profile); 
    ^
25 warnings generated. 
cc -O2 -c -o weibull.o weibull.c 
In file included from weibull.c:25: 
./swat.h:85:35: warning: '/*' within block comment [-Wcomment] 
    /* int *maxstu_vec; NOT NEEDED /* array of length length + 1, used to hold row of scores, 
           ^
weibull.c:47:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
reject_entry(score_entry) 
^ 
weibull.c:50:32: warning: '&&' within '||' [-Wlogical-op-parentheses] 
    return (!parameters->nw_flag && !score_entry->score || score_entry->length < LENGTH_CUTOFF); 
      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ~~ 
weibull.c:50:32: note: place parentheses around the '&&' expression to silence this warning 
    return (!parameters->nw_flag && !score_entry->score || score_entry->length < LENGTH_CUTOFF); 
          ^
      (          ) 
weibull.c:53:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
alloc_hist() 
^ 
weibull.c:65:1: warning: control reaches end of non-void function [-Wreturn-type] 
} 
^ 
weibull.c:67:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
initialize_hist() 
^ 
weibull.c:78:1: warning: control reaches end of non-void function [-Wreturn-type] 
} 
^ 
weibull.c:80:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
update_hist(score_entry, z_flag) 
^ 
weibull.c:88:5: error: non-void function 'update_hist' should return a value [-Wreturn-type] 
    return; 
    ^
weibull.c:92:5: error: non-void function 'update_hist' should return a value [-Wreturn-type] 
    return; 
    ^
weibull.c:106:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
prune_hist(score_entry) 
^ 
weibull.c:111:34: error: non-void function 'prune_hist' should return a value [-Wreturn-type] 
    if (reject_entry(score_entry)) return; 
           ^
weibull.c:127:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
process_hist() 
^ 
weibull.c:155:5: warning: implicit declaration of function 'fatalError' is invalid in C99 [-Wimplicit-function-declaration] 
    fatalError("No entries have scores exceeding -gap_init"); 
    ^
weibull.c:168:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
fit_log_n(q_length) 
^ 
weibull.c:300:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
est_lambda_K(q_length) 
^ 
weibull.c:399:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
new_est_lambda_K(q_length, score_entries, last_score_entry) /* using non-extreme-value dist'n */ 
^ 
weibull.c:644:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
find_z(entry) 
^ 
weibull.c:652:21: warning: implicit declaration of function 'make_log_table' is invalid in C99 [-Wimplicit-function-declaration] 
    if (!log_table) make_log_table(); 
        ^
weibull.c:665:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] 
make_log_table() 
^ 
17 warnings and 3 errors generated. 
make: *** [weibull.o] Error 1 

也許你一個人有任何想法,問題可能是什麼???

我將每一個答案:)

回答

0

我找到了一個解決方案。正如我已經擔心的那樣,問題在於編譯器。 我安裝了一個相對較新的版本(gcc 4.9),將此版本設置爲活動並在〜/ .bash_profile中添加路徑(這是最重要的步驟)。此外,我採用了makefile。打開一個新終端並輸入「make」即可正常運行。

+0

這看起來像我在編譯廢話的問題。你可以添加信息的具體方式嗎?代碼將是最有幫助的。 – nya

1
weibull.c:88:5: error: non-void function 'update_hist' should return a value [-Wreturn-type] 
    return; 
    ^
weibull.c:92:5: error: non-void function 'update_hist' should return a value [-Wreturn-type] 
    return; 
    ^

weibull.c:111:34: error: non-void function 'prune_hist' should return a value [-Wreturn-type] 
    if (reject_entry(score_entry)) return; 
           ^

必須返回給定函數的頭型vaule非常高興。

相關問題