Cygwin程序编译但不可运行

时间:2017-08-28 09:18:26

标签: bash compiler-errors compilation cygwin

我刚刚安装了CD-HIT并按照这些说明操作:

Installation
Most CD-HIT programs were written in C++. Installing CD-HIT package is very simple: 
download current CD-HIT at http://bioinformatics.org/cd-hit, for example cd-hit-2006-0215.tar.gz
unpack the file with ” tar xvf cd-hit-2006-0215.tar.gz --gunzip”
change dir by “cd cd-hit-2006”
compile the programs by “make”
you will have all cd-hit programs compiled

我按照这些步骤操作,确实制作了.exe个文件:

cdhit.c++          cdhit-est-2d.c++               clstr_select_rep.pl
cd-hit.exe         cd-hit-est-2d.exe              clstr_size_histogram.pl
cdhit.o            cdhit-est-2d.o                 clstr_size_stat.pl
cdhit-2d.c++       cd-hit-para.pl                 clstr_sort_by.pl
cd-hit-2d.exe      cdhit-utility.c++              clstr_sort_prot_by.pl
cdhit-2d.o         cdhit-utility.h                clstr_sql_tbl.pl
cd-hit-2d-para.pl  cdhit-utility.o                clstr_sql_tbl_sort.pl
cdhit-454.c++      ChangeLog                      clstr2tree.pl
cd-hit-454.exe     clstr_cut.pl                   clstr2txt.pl
cdhit-454.o        clstr_list.pl                  clstr2xml.pl
cd-hit-auxtools    clstr_list_sort.pl             doc
cdhit-common.c++   clstr_merge.pl                 FET.pl
cdhit-common.h     clstr_merge_noorder.pl         license.txt
cdhit-common.o     clstr_quality_eval.pl          make_multi_seq.pl
cdhit-div.c++      clstr_quality_eval_by_link.pl  Makefile
cd-hit-div.exe     clstr_reduce.pl                plot_2d.pl
cdhit-div.o        clstr_renumber.pl              plot_len1.pl
cd-hit-div.pl      clstr_rep.pl                   psi-cd-hit
cdhit-est.c++      clstr_reps_faa_rev.pl          README
cd-hit-est.exe     clstr_rev.pl                   usecases
cdhit-est.o        clstr_select.pl

然而,当我在cygwin命令行中打字:cd-hit-est时,会说:-bash: cd-hit.exe: command not found。我无法弄清楚为什么会这样。即使我在文件夹中找到了.exe个文件,它仍然会给出相同的错误。

1 个答案:

答案 0 :(得分:0)

当您尝试运行没有路径的命令时,bash会尝试从PATH环境变量中查找每个目录中的命令名称。 通常是当前目录"。"不在PATH中,因此您必须在命令名称之前运行命令添加绝对路径或相对路径:

./cd-hit.exe

/absolute/path/to/your/cd-hit/program/cd-hit.exe

如果要从任何地方永久运行命令 cd-hit.exe ,只需将编译cd-hit的目录添加到任何现有的自动加载的bash配置文件中:

.profile
.bashrc
.bash_profile

PATH=$PATH:/absolute/path/to/your/cd-hit/program
export PATH