[cfe-dev] Objective-C Boxed Expressions Error: unexpected '@' in program
David Chisnall
David.Chisnall at cl.cam.ac.uk
Tue Dec 4 01:04:08 PST 2012
The new syntax is only supported with the non-fragile ABI. Please add either -fobjc-nonfragile-abi or -fobjc-runtime=gnustep to your compile flags.
The new ABI is the default on *BSD, however clang defaults to the GCC ABI on GNU platforms for greater compatibility with legacy Objective-C implementations.
David
On 4 Dec 2012, at 06:05, Charalampos Chrysovalantis Emmanouilidis wrote:
> I'm trying to compile some Boxed Expressions with clang 3.1
>
> ##
> # Clang Version
> ##
> charemma $ clang --version
> Debian clang version 3.1-5ppa1 (branches/release_31) (based on LLVM 3.1)
> Target: i386-pc-linux-gnu
> Thread model: posix
>
> ##
> # Sample code in main.c
> ##
> NSString *path = @(getenv("PATH"));
> NSLog(@"PATH %@", path);
>
>
> ##
> # compiler usage
> ##
> charemma$ clang -x objective-c -I/opt/GNUstep/include -o main.c.o -c main.c
> main.c:10:22: error: unexpected '@' in program
> NSString *path = @(getenv("PATH"));
> ^
> 1 error generated.
>
> Do I need to pass any specific flag to clang to get support for Boxed Expressions like @(getenv("PATH"))?
>
> According to this article http://clang.llvm.org/docs/ObjectiveCLiterals.html this should be supported starting with clang v3.1
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list