Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 23, 2013, 03:28 AM   #1
mehdies
macrumors member
 
Join Date: Jun 2012
-fobjc-arc is not supported error and duplicate symbol error in compiling

Hi all

I have a source code with Three files:

1 - main.m
2 - methods.h
3 - methods.m

I declare methods in methods.h and put definitions of methods in methods.m.
and create an object in main.m for using methods of the Class.

But when i compiling my source in xcode got this error :

Code:
error: -fobjc-arc is not supported on platforms using the legacy runtime
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
and when methods.m in Build phases -> Compile sources is present got Duplicate symbol error too.

Could you help me?
mehdies is offline   0 Reply With Quote
Old Sep 23, 2013, 01:10 PM   #2
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
Quote:
Originally Posted by mehdies View Post
Hi all

I have a source code with Three files:

1 - main.m
2 - methods.h
3 - methods.m

I declare methods in methods.h and put definitions of methods in methods.m.
and create an object in main.m for using methods of the Class.

But when i compiling my source in xcode got this error :

Code:
error: -fobjc-arc is not supported on platforms using the legacy runtime
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
and when methods.m in Build phases -> Compile sources is present got Duplicate symbol error too.

Could you help me?
ARC isn't supported for 32 bit apps on OSX. You'll need to either only build 64 bit (which would be my suggestion), or not use ARC.
Catfish_Man is offline   1 Reply With Quote
Old Sep 23, 2013, 01:49 PM   #3
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by mehdies View Post
and when methods.m in Build phases -> Compile sources is present got Duplicate symbol error too.
Post the complete text of the Duplicate symbol error.

Also post your complete code, so we know what the error is referring to.
chown33 is offline   0 Reply With Quote
Old Sep 24, 2013, 01:57 AM   #4
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Source Information :

methods.h

Code:
#import <Foundation/Foundation.h>


NSString *string1 = @"test string1";
NSString *string2 = @"test string2";



@interface methods : NSObject

-(void) methodOne;

-(void) methodTwo;

-(void) methodThree;

@end
methods.m

Code:
#import "methods.h"


@implementation methods



-(void) methodOne
{
	NSLog(@"method 1");
}

-(void) methodTwo
{
	NSLog(@"method 2");
}

-(void) methodThree
{
	NSLog(@"method 3");
}

@end
main.m

Code:
#import <Foundation/Foundation.h>
#import "methods.h"



int main(int argc, const char * argv[])
{
    
    @autoreleasepool {
        
        
        methods *objectOfClass = [[methods alloc] init];
        
        
        [objectOfClass methodOne];
        [objectOfClass methodTwo];
        [objectOfClass methodThree];
            
            
      
        
        
    }
    
    return 0;
}
These source not my real code but exactly is like this.

** Duplicate was for string1 and string2.so i cut these strings and paste in methods.m and problem solved.

** Thanks to Catfish_Man - I not use ARC now and problem solved.




Thanks
mehdies is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mach-O Linker Error: Duplicate Symbols moonman239 iPhone/iPad Programming 5 Oct 21, 2013 09:08 PM
Error: "symbol(s) not found for architecture x86_64" TangoOversway Mac Programming 3 Mar 6, 2013 06:46 PM
Outlook 2011--Duplicate folder name error 1025 Hookemfins Mac Applications and Mac App Store 2 Feb 15, 2013 07:53 PM
Double Free error with ARC cocoaADay Mac Programming 0 Dec 2, 2012 08:54 PM
PowerPC applications no longer supported error message amyhs Mac OS X 10.7 Lion 8 Sep 6, 2012 01:30 PM

Forum Jump

All times are GMT -5. The time now is 03:30 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC