Results 1 to 13 of 13

Thread: CL_ResourceManager init problem. (OSX)

  1. #1
    Squire Otto (Strange) Halmén's Avatar
    Join Date
    Sep 2006
    Location
    A city called Loviisa, in southern Finland, Europe.
    Posts
    20

    Default CL_ResourceManager init problem. (OSX)

    Hello,

    I'm having a problem with opening the XML resource file. In RC2, I think I remember that this line of code...
    CL_ResourceManager *resources = new CL_ResourceManager("resources.xml");
    ...would open the resources.xml file which was situated in the ClanApp.app/Contents/Resources directory. (I've got an old application build using RC2 still left, and it works like a charm.) However, now the application crashes on this line. (That is, if I comment the line the app doesn't crash, but if I uncomment it it does) Do I have to make changes to the filename, or is it (again) something else that I have mistaken? I have double-checked that the XML file and all files and directories that it refers to are contained in the application bundle.
    In Finnish, "Strange" is spelled "Outo" which is very similar to my real first name, but that's not the main reason why my friends chose to call me that...

    No homepage yet, but when my raycaster becomes good enough to be released, I'll make one.

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Do you have a Try / Catch around your app? If so, it might show you whats wrong - either if the file is not found, or something else.

  3. #3
    Squire Otto (Strange) Halmén's Avatar
    Join Date
    Sep 2006
    Location
    A city called Loviisa, in southern Finland, Europe.
    Posts
    20

    Default

    Yes, I have try/catch, and when I opened the application from the terminal, it only gave me the text:
    Macintosh:~ ottohalmen$ /Users/ottohalmen/MonkeySong/build/MonkeySong.app/Contents/MacOS/MonkeySong; exit
    terminate called after throwing an instance of 'CL_Error'
    Abort trap
    logout
    [Process completed]
    This text is displayed almost identical in the run log when the application is run from XCode. This row of code...
    CL_ConsoleWindow console("Console");
    ...is supposed to open a console window, but I don't know if the debug text is written into it or the XCode run log, because there is no separate console window being opened when the application is ran.

    Running the application from Finder doesn't display anything.
    In Finnish, "Strange" is spelled "Outo" which is very similar to my real first name, but that's not the main reason why my friends chose to call me that...

    No homepage yet, but when my raycaster becomes good enough to be released, I'll make one.

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Do you catch a CL_Error exception?

    try
    {
    ...
    }
    catch (CL_Error exception)
    {
    CL_Console::write_line("Exception caught: %1", exception.message.c_str());
    }

  5. #5
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    CL_ConsoleWindow only works under Windows currently I believe.

    If the CL_Error catching isn't working, check this from the INSTALL.macosx file:

    6. F.A.Q.

    Q:

    My try/catch doesn't seem to be able to catch CL_Error throws, instead I just get a segfault!

    A:

    Due to changes to default visibility attributes in gcc 4.0 it is necessary
    to make the following changes to your XCode 2.2+ projects (ClanLib and your app's):

    Look for "Symbols Hidden By Default" and set it to unchecked. If it's
    already unchecked, check it and uncheck it anyway, so it will override
    whatever the default is.

    That may be all that is needed, but perhaps you need Inline Functions Hidden
    unchecked as well, not sure, something to try if you have any problems.
    Seth A. Robinson
    Robinson Technologies

  6. #6
    Squire Otto (Strange) Halmén's Avatar
    Join Date
    Sep 2006
    Location
    A city called Loviisa, in southern Finland, Europe.
    Posts
    20

    Default

    Sphair, I am sorry but your solution gives me only the following:
    main.cpp:70: error: 'write_line' was not declared in this scope
    main.cpp:70: error: `CL_Console' has not been declared
    The class CL_Console is not even listed here...

    Seth, where can I find those options?
    In Finnish, "Strange" is spelled "Outo" which is very similar to my real first name, but that's not the main reason why my friends chose to call me that...

    No homepage yet, but when my raycaster becomes good enough to be released, I'll make one.

  7. #7
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    I'm sorry, but I pasted from some ClanLib 0.9 code. But my point was to make sure you catch the right exception. How you display the error wasn't really important.

  8. #8
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    Quote Originally Posted by Otto (Strange) Halmén View Post
    Seth, where can I find those options?
    Hmm, I don't have my mac on or I could give you the exact location, but they are listed under XCode's project options page, that page where it lists like a million things and you can enter words to filter it by.
    Seth A. Robinson
    Robinson Technologies

  9. #9
    Squire Otto (Strange) Halmén's Avatar
    Join Date
    Sep 2006
    Location
    A city called Loviisa, in southern Finland, Europe.
    Posts
    20

    Default

    Look for "Symbols Hidden By Default" and set it to unchecked.
    Now I have done that...
    ...but perhaps you need Inline Functions Hidden
    unchecked as well...
    ...and that.
    (Both of them were unchecked already, but I checked and unchecked them.)

    Do you know any other way to display error messages than Windows-only console windows? Initializing the components and creating a new display window after the throw of the error doesn't work, I've tried.
    In Finnish, "Strange" is spelled "Outo" which is very similar to my real first name, but that's not the main reason why my friends chose to call me that...

    No homepage yet, but when my raycaster becomes good enough to be released, I'll make one.

  10. #10
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    Ok, first, make sure you do these changes to the original ClanLib XCode project (not just your app) and rebuild that as well.

    Under Mac, you can just use cout for debug messages, if you run from the command line you'll see it, or use the system log browser app (? can't quite remember the name, but it shows all errors and messages the system has done recently) Also, I think in xcode it will show the messages from cout. Or maybe you have to be in debug mode, not sure.

    So, you should have something like this:
    Code:
    try 
    {
      //do something that will crash, for instance, just do this for testing:
       throw CL_Error("Holy moly!");
    }
    catch(CL_Error error)
    {
        std::cout << "Exception caught : " << error.message << std::endl;	
    }
    Seth A. Robinson
    Robinson Technologies

  11. #11

    Default

    Can't you just set a breakpoint there and run it through a debugger?

  12. #12

    Default

    ...or even flush it to a file?

  13. #13

    Default

    Sorry for resurrecting this thread up but I would like to point out an additional tip which might prevent CL_Error from being caught because of cross-binary exceptions issues under Mac OS X in addition to the visibility issue: Make sure that ZeroLink is disabled.

Similar Threads

  1. bow problem
    By rabidwolf9 in forum Dink Smallwood HD
    Replies: 0
    Last Post: 12-23-2004, 08:28 PM
  2. Problem
    By Dorian1 in forum Dink Smallwood HD
    Replies: 2
    Last Post: 08-26-2004, 04:42 AM
  3. Problem
    By Wishchrono in forum Dink Smallwood HD
    Replies: 1
    Last Post: 08-24-2004, 06:57 PM
  4. Problem
    By in forum Other RTsoft Games
    Replies: 2
    Last Post: 06-09-2003, 06:12 PM
  5. FQ Problem
    By in forum Funeral Quest
    Replies: 5
    Last Post: 08-18-2002, 10:28 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •