zoukankan      html  css  js  c++  java
  • [Bug-IOS]

    Ld /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Products/Debug/OC_Language normal x86_64

        cd /Users/Rubert/IOS/iworkspace/OC_Language

        export MACOSX_DEPLOYMENT_TARGET=10.10

        /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Products/Debug -F/Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Products/Debug -filelist /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/OC_Language.LinkFileList -mmacosx-version-min=10.10 -fobjc-arc -fobjc-link-runtime -Xlinker -dependency_info -Xlinker /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/OC_Language_dependency_info.dat -o /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Products/Debug/OC_Language

     

    duplicate symbol _OBJC_CLASS_$_Student in:

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/main.o

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/Student.o

    duplicate symbol _OBJC_METACLASS_$_Student in:

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/main.o

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/Student.o

    duplicate symbol _OBJC_IVAR_$_Student.s in:

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/main.o

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/Student.o

    duplicate symbol _OBJC_IVAR_$_Student.age in:

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/main.o

        /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Intermediates/OC_Language.build/Debug/OC_Language.build/Objects-normal/x86_64/Student.o

    ld: 4 duplicate symbols for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

     该问题主要是因为引用的头文件不对。

     1 #import <Foundation/Foundation.h>
     2 #import "Student.m"
     3 
     4 int main(int argc, const char * argv[]) {
     5    @autoreleasepool {
     6 //        
     7 //        
     8 ////1.基本类型()
     9 //NSLog(@"Hello, World!");
    10 //DataTypes_Clazz *stu = [[DataTypes_Clazz alloc] init];
    11 //[stu release];
    12 //2.基本语法
    13        
    14     //创建方式1
    15     Student *sPo = [Student alloc];
    16     sPo = [sPo init];
    17     [sPo setAge:(34)];
    18     NSLog(@"sPo.Age:%d",[sPo getAge]);
    19        
    20     //创建方式2
    21     Student *sPo2 = [[Student alloc] init];
    22     [sPo2 setAge:(12)];//设置值
    23     NSLog(@"sPo2.Age:%d",[sPo2 getAge]);
    24        
    25     //创建方式3
    26     //NSString *ns = [[NSString alloc] init];
    27     NSString *ns2 = @"2323232";
    28        
    29    Student *sPo3 = [[Student alloc] initWithAge:(34) s:(ns2)];
    30    [sPo3 setAge:(24)];//设置值
    31    NSLog(@"sPo3.Age:%d",[sPo3 getAge]);
    32    NSLog(@"sPo3.S:%p",[sPo3 getS]);
    33     
    34    }
    35     
    36     return 0;
    37 }
    应该是#import "Student.h",一不小心就犯了这个种低级错误。
  • 相关阅读:
    CSS
    html5
    XHTML
    HTML
    git 教程 --git revert 命令
    Git 教程 --git merge 命令
    git 教程 --git reset 命令
    git 教程 --git cherry-pick 命令
    git 教程 --git stash命令
    git 教程 --git diff功能
  • 原文地址:https://www.cnblogs.com/royi123/p/5372583.html
Copyright © 2011-2022 走看看