Clang – Baidu Encyclopedia
Clang is an Apple-led, LLVM-based C/C++/Objective-C compiler. \
- You can use clang to compile into c++ files, see the underlying structure and trace the source implementation.
- Clang’s official website
Common commands
- Clang-rewrite-objc main.m -o main. CPP compiles the object file into a c++ file
An error
- Compile the person.m file: Clang-rewrite-objc-fobjc-arc-fobjc-runtime = ios-13.0.0-isysroot / Applications/Xcode. App/Contents/Developer/Platforms/iPhoneSimulator platform/Developer/SDKs/iPhoneSimulator13.0. The SDK Clang: error: no such file or directory: ‘iPhoneSimulator. Platform/Developer/SDKs/iPhoneSimulator13.0. SDK’
Solution: Xcode displays package contents to find if 13.0.sdk exists in this path and replace it with existing one.
xcrun
Xcode is installed with the xcrun command, which is a bit more wrapped around clang to make it easier to use
Xcrun – SDK iphonesimulator clang -arch arm64 -rewrite-objc main.m -o main-arm64.cpp
Xcrun – SDK iphoneOS clang -arch arm64 – rerewrite -objc main.m -o main-arm64.cpp