-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0df8e2f
commit 2ea1f44
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## 如何将 `Obj-C` 代码改变为 `C++/C` 的代码? | ||
|
||
``` | ||
// 在当前路径下执行 | ||
clang rewrite-objc main.m -o main.cpp | ||
``` | ||
上面的方法会生成不同平台下的源代码,大约有10万行,但我们只想要 iOS 平台下的相关代码,我们可取以下的方式: | ||
|
||
|
||
``` | ||
// xcrun == Xcode Run | ||
// -sdk 指定系统平台 | ||
// -arch 指定的架构 | ||
xcrun -sdk iphoneos clang -arch arm64 -rewrite-objc main.m -o main-arm64.cpp | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters