我在编译时收到此错误。
Ld /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug/SambaTestApp normal x86_64
cd "/Users/alex/Documents/Xcode Projects/SambaTestApp"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug -F/Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug -filelist /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Intermediates/SambaTestApp.build/Debug/SambaTestApp.build/Objects-normal/x86_64/SambaTestApp.LinkFileList -mmacosx-version-min=10.7 -fobjc-arc -framework Foundation -o /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug/SambaTestApp
Undefined symbols for architecture x86_64:
"_FSMountServerVolumeSync", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我的代码是:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSString * user = @"user";
NSString * password = @"pass";
NSURL * url = [NSURL URLWithString: @"smb://lemon"];
NSURL * mountDir = [NSURL URLWithString: @"/review"];
OptionBits flags = 0;
OSStatus err = FSMountServerVolumeSync (
(__bridge CFURLRef) url,
(__bridge CFURLRef) mountDir,
(__bridge CFStringRef) user,
(__bridge CFStringRef) password,
NULL,
flags);
if(err != noErr)
NSLog( @"some kind of error in FSMountServerVolumeSync - %d", err );
}
return 0;
}