[cfe-dev] Objective-C Boxed Expressions Error: unexpected '@' in program
Charalampos Emmanouilidis
chrys.emmanouilidis at gmail.com
Wed Dec 5 09:47:51 PST 2012
Tried both compile flags as you suggested:
#-fobjc-nonfragile-abi
charemma$ clang -x objective-c -I/opt/GNUstep/include -fobjc-nonfragile-abi -o main.c.o -c main.c
main.c:10:22: error: unexpected '@' in program
NSString *path = @(getenv("PATH"));
^
1 error generated.
# -fobjc-runtime=gnustep, please note, this flag is not even recognized
charemma$ clang -x objective-c -I/opt/GNUstep/include -fobjc-runtime=gnustep -o main.c.o -c main.c
clang: warning: argument unused during compilation: '-fobjc-runtime=gnustep'
main.c:10:22: error: unexpected '@' in program
NSString *path = @(getenv("PATH"));
^
1 error generated.
On Dec 4, 2012, at 10:04 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121205/df004992/attachment.html>
More information about the cfe-dev
mailing list