2016-09-29 75 views
1

我剛剛更新到塞拉利昂,似乎我的編譯器土崩瓦解出於某種原因。與執行a.out文件(C++)發行的MacOS塞拉利昂10.12.1

我寫的代碼更新之前工作得很好,所以我敢肯定它根本不是問題,但現在它只是不工作什麼那麼當我嘗試執行它。

這裏是輸出。

$ g++ source.cpp 
$ ./a.out 
dyld: mach-o, but built for simulator (not macOS) 
Abort trap: 6 

運行G ++具有詳細用於@NulledPointer

$ g++ --verbose source.cpp 
Apple LLVM version 8.0.0 (clang-800.0.38) 
Target: x86_64-apple-darwin16.1.0 
Thread model: posix 
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-ios7.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name source.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -stdlib=libc++ -Wno-error -fdeprecated-macro -fdebug-compilation-dir /Users/USERNAME/FILE_DIRECTORY/ -ferror-limit 19 -fmessage-length 130 -stack-protector 1 -fblocks -fobjc-runtime=ios-7.0.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/kr/tvqfrgdx2w32m0c9fq96zddc0000gn/T/source-355902.o -x c++ source.cpp 
clang -cc1 version 8.0.0 (clang-800.0.38) default target x86_64-apple-darwin16.1.0 
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/c++/v1" 
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/local/include" 
#include "..." search starts here: 
#include <...> search starts here: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/System/Library/Frameworks (framework directory) 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/Library/Frameworks (framework directory) 
End of search list. 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -ios_simulator_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -o a.out /var/folders/kr/tvqfrgdx2w32m0c9fq96zddc0000gn/T/source-355902.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.ios.a 

錯誤從運行該命令NulledPointer張貼。

clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk' 
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' 
In file included from source.cpp:10: 
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38: 
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:215: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:10: fatal error: 
     'wchar.h' file not found 
#include <wchar.h> // for mbstate_t 
     ^
1 error generated. 
+0

檢查[這](http://stackoverflow.com/a/19840324/1157879) – Nikhil

+0

這似乎是一個不同的問題比我經歷的我,是關於在iOS應用鏈接庫。我只是編譯並執行一個CPP文件。 –

+0

什麼是你'LS -lh $(其中G ++)' – PnotNP

回答

0

可以有多種選擇:

  • 嘗試安裝缺少的工具(如果有的話)使用xcode-select --install和嘗試編譯。如果失敗,
  • 嘗試運行gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk source.cpp。這顯然假設你已經在該位置安裝了SDK。替換那裏存在的任何位置。
+0

我收到一個致命錯誤,我將在問題中發帖,然後我已經安裝了這些工具...這是一個有趣的錯誤。 –

相關問題