Exception Handling + UNIX

This is a discussion on Exception Handling + UNIX within the C++ Programming forums, part of the General Programming Boards category; does anyone in here know how to use exception handling on UNIX, when i compile it on Microsoft Visual my ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    18

    Exception Handling + UNIX

    does anyone in here know how to use exception handling on UNIX, when i compile it on Microsoft Visual my Code works, when i put the same code on UNIX, which i need to use it for because my teacher wants me to use unix, it wont work at all, someone please help ...

    thanx

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    18
    oh yah, my emailed address is DRFUNKENSTINE@aol.com, so email me there with the answer if you know it, thank you!

    :-)

  3. #3
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    how are you doing it?

    usually it's just
    Code:
    try {
     /* possible problem code */
    } 
    catch(type1 arg) {
     /* do error stuff */
    }
    catch(type2 arg) {
     /* do error stuff */
    }
    Please post a more specific problem if this doesn't help.

  4. #4
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Do you know what compiler your teacher uses at school? Likely, it's GCC. You can get a free copy of GCC for windows (the easiest way is to download bloodshed dev-c++). You can still develop the code with msvc, but when you want to submit it, open it in dev c++ and see if it compiles. Likely, you are depending on some MSVC non-standard quirks that dev c++ will complain about, and that you can fix before submitting.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  5. #5
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    I think you are reffering to porting your code from windows to unix. if so just make precompiler statements and when you compile your code just set the precompiler define statement for the platform to what ever system you are using at that time...

    ie:
    #define UNIX 1
    #define MSVC 2

    #if PLATFORM == UNIX
    // .... do whatever for unix
    #else
    // ... do whatever for other supported compilers
    #endif

  6. #6
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    It's not even platform problems I am guessing, but rather compiler problems. For instance, the following is an error in standard C++, but MSVC will compile it fine

    Code:
    int main() {
        for (int i = 0; i < 10; i++) { // standard scope of i
        }
        // MSVC's scope of i
        for (i = 0; i < 10; i++) { // valid in MSVC, not in standard C++ 
        }
        return 0;
    }
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal handling and exception handling
    By lehe in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2009, 11:01 PM
  2. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 07:33 AM
  3. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  4. is such exception handling approach good?
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 12-27-2007, 08:54 AM
  5. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21