Xcode C++ and Objective-C refactoring
2017-04-29 13:07
295 查看
Is there a way to refactor mixed C++/Objective-C code in Xcode ?? I am writing a game using Cocos2D and Box2D, and the Box2D is written on C++, so every class I write should have .mm extension and therefore when I try to e.g. rename the variable, I got a message like "Xcode can only refactor C and Objective-C code".
答案
答案
Xcode is VERY limited with refactoring, even with plain Obj-C. It's basically renaming and it can't even rename in comments. If it says it can't do something, then it probably can't. The only way to rename is using find & replace. Note that Xcode can handle regular expressions so it is often good enough. Of course, the problem is that find & replace doesn't know the programming language and sometimes can add some extra replace or forget to replace something, therefore be extra careful. Clean build is neccessary after every refactoring to check everything got renamed correctly. You can also use command line tools (e.g. sed) to achieve the same.
| |||||||||||||||||||||
|
相关文章推荐
- iphone开发之C++和Objective-C混编 如何在xcode中用C++的STL
- iphone开发之C++和Objective-C混编 如何在xcode中用C++的STL
- iphone开发之C++和Objective-C混编 如何在xcode中用C++的STL
- iphone开发之C++和Objective-C混编 如何在xcode中用C++的STL
- __block的两种核心用法(摘自iOS 7 Programming Fundamentals: Objective-C, Xcode, and Cocoa Basics)
- Mixing Objective-C, C++ and Objective-C++: an Updated Summary
- Eclipse C++ and Xcode for Mac
- 关于在xcode里面c++代码与objective-c代码混编的问题
- Mixing Objective-C, C++ and Objective-C++: an Updated Summary
- iphone开发之C++和Objective-C混编 如何在xcode中用C++的STL
- Xcode中Objective-C和C++混编的实现 (二)
- Strategies for Using C++ in Objective-C Projects (and vice versa)
- Xcode中C++ / Objective-C 混合编译
- Google编码规范 C++ Style Guide, JavaScript Style Guide, Objective-C Style Guide, and Python Style Guide
- 在Xcode中使用C++与Objective-C混编
- 在Xcode中使用C++与Objective-C混编
- c++ - How to use wstring and wcout to output Chinese words in Xcode? - Stack Overflow
- 用c++ 操作mysql 数据库类(for linux or windows and others)
- [C++]实验二:Pointer and Reference
- [Programming Visual C++]Chapter Six-Setting the Color for the Dialog Background and for Controls