分类目录Xcode

Command Line Tools

  1. xcode-select –install
    xcode-select–install 实际上是启动了 /System/Library/CoreServices/Install Command Line DeveloperTools.app 应用,该应用从Apple服务器上下载「CLToolsExecutables.pkg」和「MacOSX109_SDK.pkg」执行安装。

  2. https://developer.apple.com/ 下载

gcc -v命令查看是否安装成功

安装在mac的根目录中
/Library/Developer/CommandLineTools/

ld: unsupported tapi file type ‘!tapi-tbd’ in YAML file
library not found for -lstdc++.6.0.9

Xcode10:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

Xcode11 beta
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib 
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

xcode

C/C++/OC编译工具
mac clang
ubuntu gcc

编译生成可执行程序
clang -g -O2 -o helloworld helloworld.c -I… -L… -l
-g输出文件中的调试信息
-O对输出文件做指令优化
-o输出文件
-I指定头文件
-L指定库文件位置
-l指定使用哪个库
-c生成库文件 clang -g -c add.c -> add.o
libtool -static -o libmylib.a add.o
clang -g -o testlib testlib.c -I . -L .-lmylib

Gdb/lldb调试器
b 设置断点
r 运行程序
n 单步执行
s 跳入函数
finish 跳出函数
p 打印内容
c
quit

cd hellowrold.dSYM/Contents/Resources/DWARF
dwarfdump xx.xxx