我想在我的Mac上使用boost.
Mac OS X 10.7.4 Xcode 4.5
我通过自制软件安装了boost.
brew install boost
Run Code Online (Sandbox Code Playgroud)
Boost版本是1.49.0.我设置了我的Xcode项目.
添加标题搜索路径.
/usr/local/Cellar/boost/1.49.0/include
Run Code Online (Sandbox Code Playgroud)
添加库
libboost * .dylib
Run Code Online (Sandbox Code Playgroud)
当我编译我的项目时,我有很多错误.Clang LLVM 1.0错误.(我想上传图片,但我无法上传,因为我没有超过10个声誉.)
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
too few template arguments for class template '__is_function'
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
field has incomplete type 'std::exception_ptr'
expected ';' at end of declaration list
no member named 'memcpy' in namespace 'std::__1'; did you mean 'memcpy'?
no …Run Code Online (Sandbox Code Playgroud) 我测试了这个示例代码.
Sample.h
{
NSString *string1;
NSString *string2;
NSMutableString *string3;
}
@property (assign) IBOutlet NSWindow *window;
@property (strong,nonatomic) NSString *string1;
@property (copy,nonatomic) NSString *string2;
@property (strong,nonatomic) NSMutableString *string3;
@end
Run Code Online (Sandbox Code Playgroud)
Sample.m
#import "Sample.h"
@synthesize string1;
@synthesize string2;
@synthesize string3;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
string1 = [[NSString alloc] init];
string2 = [[NSString alloc] init];
string3 = [[NSMutableString alloc] initWithString:@"test"];
string2 = string3;
string1 = string3;
[string3 appendString:@"test"];
NSLog(@"%@",string1);
NSLog(@"%@",string2);
NSLog(@"%@",string3);
}
@end
Run Code Online (Sandbox Code Playgroud)
结果是
2012-09-23 00:11:48.610 sample[13468:303] testtest
2012-09-23 00:11:48.611 sample[13468:303] testtest
2012-09-23 00:11:48.611 …Run Code Online (Sandbox Code Playgroud)