[问题]XCODE 7.1 C++的编译问题

楼主: arhtur945 (AnthonyBennet)   2015-12-23 17:26:39
大家好
小弟我算是Coding的新手
在MAC上我一直都是用Sublime Text3 加上 build system来写 c++
这是我的build system 内容(因为我不会写,只好载别人的)
{
"cmd": ["clang++", "${file}","-std=c++11", "-stdlib=libc++", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "clang++ '${file}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
我用这个方法大概用了快半年,但最近出现问题
会出现这个error
[Errno 2] No such file or directory: 'clang++'
[cmd: ['clang++', '/Users/ArthurWang/Documents/Code/C++/OOP/HW/HW11/HW11-1.cpp', '-std=c++11', '-stdlib=libc++', '-o', '/Users/ArthurWang/Documents/Code/C++/OOP/HW/HW11/HW11-1']]
[dir: /Users/ArthurWang/Documents/Code/C++/OOP/HW/HW11]
[path: /usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin]
[Finished]
因为我不知道问题在哪,所以暂时直接用终端机直接打 clang++ 档名.cpp 做编译
但不知道为什么他不让我用 C++11 extension的东西 (ex: range-base for loop)
然后用gcc 会出现
Undefined symbols for architecture x86_64:
.......
ld: symbol(s) not found for architecture x86_64
而我到Xcode7.1 却可以做编译
我以为Xcode是用 Clang 做编译
请问是遇到了什么问题呢?
作者: abcdefghi   2015-12-23 17:47:00
新手建议用Xcode的环境比较方便

Links booklink

Contact Us: admin [ a t ] ucptt.com