我想在我的 Objective-C 代码中使用 C++ 字符串对象而不是 NSString,所以我不需要隐藏它(我更经常需要 std::string),我尝试这样做:
using namespace std;
@interface InstrumentGridViewController : UIViewController {
string* trackName; // also tried using std::string, didn't work
@property (nonatomic, assign) string* trackName;
}
不过,我遇到了错误,string* trackName;
语句和@property
行都给了我Expected specifier-qualifier-list 'string'
.
编辑:我忘了添加#include <string>
,但添加这给了我错误String: no such file or directory