测试平台:macbook air 2012 , os x 10.9.2 , eclipse 4.3
在升级了 10.9 之后,eclipse 的CDT 无法正常使用了
异常表现:
1. 文件乱码
2. command + b 后异常的错误(编译异常)
3. Launch Failed Binary Not Found
4. eclipse 无法debug
解决方法:
1. project--properties--resources--text file encoding --other--uft-8
2. Project > Properties > C/C++ General > Preprocessor Include Paths, Macros etc.
查看"Providers" 选项, 如果 "CDT GCC Built-in Compiler Settings MinGW [shared]" 没有选择,那么就选上,然后点击"Apply" and “Ok".
3. Project > Properties > C/C++ Build > Settings > Binary Parsers : Make sure "Mach-O 64 Parser is selected"
4. 因为10.9 移除了gdb 所以无法debug。解决方法
4.1 安装brew:在terminal 中输入 ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
4.2 brew doctor
4.3 使用brew在线安装GDB调试器:
$ brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
4.4 Codesigning gdb
4.4.1 Y
ou need to create a certificate and sign gdb:
2. Open application “Keychain Access” (/Applications/Utilities/Keychain Access.app)
3. Open menu /Keychain Access/Certificate Assistant/Create a Certificate...
Choose a name (gdb-cert in the example), set “Identity Type” to “Self Signed Root”, set “Certificate Type” to “Code Signing” and select the “Let me override defaults”. Click “Continue”.
4. You might want to extend the predefined 365 days period to 3650 days.
5. Click several times on “Continue” until you get to the “Specify a Location For The Certificate” screen, then set “Keychain to System”.
6. If you can't store the certificate in the “System” keychain, create it in the “login” keychain, then export it. You can then import it into the “System” keychain.
7. In keychains select “System”, and you should find your new certificate. Use the contextual menu for the certificate, select “Get Info”, open the “Trust” item, and set “Code Signing” to “Always Trust”.
8.You must quit “Keychain Access” application in order to use the certificate and restart
“taskgated” service by killing the current running “taskgated” process. Alternatively you can restart your computer.
9. Finally you can sign gdb:
$ codesign -s gdb-cert /usr/local/bin/gdb
参考连接:
http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5