黑马程序员-程序编译错误总结01

来源:互联网 发布:资生堂红色蜜露 知乎 编辑:程序博客网 时间:2024/06/02 16:59

------<a href="http://www.itheima.com" target="blank">Java培训、Android培训、iOS培训、.Net培训</a>、期待与您交流! -------

一、xcode路径改变会报的错误

因为我之前把xcode没有安装到Applications里面,因为第一次用mac系统,不知道怎么安装程序,结果xcode就莫名奇妙的打开了,然后

我就一直那样运行程序,结果发现我每次打开是程序里面就不会发现有xcode这个程序,后来知道安装软件应该装到applications里面,于

是又把它重新的安装到applications里面;然后运行程序是就终端上会出现这样的错误

xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, 

use xcode-select to change

 这个错误的原因就是xcode的路径改变了

然后在终端上输入:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

此时终端显示

WARNING: Improper use of the sudo command could lead to data loss

or the deletion of important system files. Please double-check your

typing when using sudo. Type "man sudo" for more information.


To proceed, enter your password, or type Ctrl-C to abort.


Password:


请你输入密码:记住密码是不会显示在终端上的,而且你只要输入就行了,然后按下回车键就okl

二、代码中输入中文符号的错误

01.变量的练习.c:19:15: error: non-ASCII characters are not allowed outside of literals and

      identifiers

出现这种问题,一般是在代码里面非注释的地方,出现了非ascii字符。
比较常见的情况是,在代码中出现了中文字符。比如在引用字符串时,用了中文的引号。或者在一行代码结尾处,使用了中文的分号。
这种问题在编译时,xcode会提示出错的行,所以解决起来就是细心观察出错的那一行,看看有什么非ASCII字符。修改完成后,编译就能通过了。






0 0
原创粉丝点击