[問題]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