try/catch/finally

  • I have the following code in my Cocoa project:

    @try {
           ...(statements)...
    } //end try
    @catch (NSException *exception) {
           ...(statements)...
    } //end catch
    @finally {
           ...(statements)...
    } //end finally

    and I get the following warning:
    warning: use '-fobjc-exceptions' to enable Objective-C exception syntax

    I'm compiling using Xcode, not the Gnu C compiler from the command
    line, so how do I tell Xcode to use '-fobjc-exceptions'?

    -- Roland Silver <rollos...>
  • Check the checkbox for it in the project properties.

    > From: Roland Silver <rollos...>
    > Subject: try/catch/finally
    >
    > and I get the following warning:
    > warning: use '-fobjc-exceptions' to enable Objective-C exception syntax
    >
    > I'm compiling using Xcode, not the Gnu C compiler from the command
    > line, so how do I tell Xcode to use '-fobjc-exceptions'?
  • On Sep 10, 2007, at 6:09 PM, Roland Silver wrote:

    > I'm compiling using Xcode, not the Gnu C compiler from the command
    > line, so how do I tell Xcode to use '-fobjc-exceptions'?

    Turn on ObjC exceptions in the target settings for all build
    configurations. They're off by default because they don't work under
    Jaguar or earlier.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • El 11/9/2007, a las 2:09, Roland Silver escribió:

    > I have the following code in my Cocoa project:
    >
    > @try {
    > ...(statements)...
    > } //end try
    > @catch (NSException *exception) {
    > ...(statements)...
    > } //end catch
    > @finally {
    > ...(statements)...
    > } //end finally
    >
    > and I get the following warning:
    > warning: use '-fobjc-exceptions' to enable Objective-C exception
    > syntax
    >
    > I'm compiling using Xcode, not the Gnu C compiler from the command
    > line, so how do I tell Xcode to use '-fobjc-exceptions'?

    Look in your build settings at either project or target-level; you do
    this by selecting the project itself or any of the targets in the
    "Groups & Files" listing and hitting Command-I, double-clicking, or
    choosing "Get Information" from the contextual menu. Then enter
    "excep" into the search field and you'll soon find the relevant
    setting. (Typed from memory, exact wording in the interface may vary.)

    Also, there is an xcode-users mailing list hosted by Apple which is
    for Xcode-related questions.

    Cheers,
    Wincent
  • On 9/10/07, Roland Silver <rollos...> wrote:
    > I have the following code in my Cocoa project:
    >
    > @try {
    > ...(statements)...
    > } //end try
    > @catch (NSException *exception) {
    > ...(statements)...
    > } //end catch
    > @finally {
    > ...(statements)...
    > } //end finally
    >
    > and I get the following warning:
    > warning: use '-fobjc-exceptions' to enable Objective-C exception syntax
    >
    > I'm compiling using Xcode, not the Gnu C compiler from the command
    > line, so how do I tell Xcode to use '-fobjc-exceptions'?

    google with "Xcode "-fobjc-exceptions" site:developer.apple.com"

    ...and note...

    <http://developer.apple.com/documentation/DeveloperTools/Reference/XcodeBuil
    dSettingRef/build_setting_ref/build_setting_ref.html
    >

    -Shawn
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today