配置NDK Cygwin .bash_profile:行47: 语法错误: 未预期的文件结尾 syntax error: unexpected end of file 解决

时间:2019-02-19
本文章向大家介绍配置NDK Cygwin .bash_profile:行47: 语法错误: 未预期的文件结尾 syntax error: unexpected end of file 解决,主要包括配置NDK Cygwin .bash_profile:行47: 语法错误: 未预期的文件结尾 syntax error: unexpected end of file 解决使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

配置NDK Cygwin .bash_profile:行47: 语法错误: 未预期的文件结尾 syntax error: unexpected end of file 解决

 

转载:https://blog.csdn.net/chenaini119/article/details/46536527

可以在cygwin中通过vim修改,也可以在windows安装目录中修改 home\<你的用户名>\.bash_profile 文件中最后添加环境变量

NDKROOT=/cygdrive/e/Andriod/develop/android-ndk-r8

export NDKROOT

其中NDK=/cygdrive/<你的盘符>/<android ndk 目录> ,"NDK"这个名字随便起,以后经常用不要太长。

重启cygwin,输入:

cd $NDK

可进入ndk对应目录说明设置OK。

这时候 出现错误

-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: /home/lenovo/.bash_profile: line 47: syntax error: unexpected end of file


在cygwin中输入:

dos2unix -n .bash_profile .bash_profile

 

 如果事先没有在cygwin安装过dos2unix,请先安装再输入该命令修改文本格式。
关闭重新打开cygwin,ok了。

重点:所以再一次提醒,不要用window里的记事本或者写字本打开修改,使用UltraEdit不要转化格式,因为在window下和linux中回车符是不相同的。