Thread: exceptions

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    9

    exceptions

    I have a c++ program which compiles with visual c++ .net 2003, but won't compile on linux with g++. The error is on this line, and it says there is no matching function for the call. Any ideas.

    #include <exception>
    using namespace std;

    ...

    throw exception("No info file");

  2. #2
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    try building with gcc, the installed on all linux boxes c c++ compiler.

    also, the code snippet you put up isn't very imformative. it makes it almost impossible to know what the error is trying to tell you.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > try building with gcc, the installed on all linux boxes c c++ compiler.
    But g++ IS the installed GNU C++ compiler on a Linux box.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    odd, my gcc is call gcc
    not g++

    and by using gcc to call it when compiling, it will compile even mixed language apps.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Location
    Stockholm, Sweden
    Posts
    64
    The C++ compiler in the GNU Compiler Collection is called G++. If your version of GCC (as in the 'Compiler Collection') is reasonably new your C++ compiler is also called G++.

    There's a difference between GCC the Compiler Collection and GCC the C Compiler.

    Is it really ANSI standard C++ to include the <exception>-header? My guess is that it's specific to MSVC and is not available with your GCC (Compiler Collection) distribution.

    edit spelling-errors have been caught and shot

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    <exception> and "class exception" are standard. The problem is that there is no constructor that takes a string.

    gg

  7. #7
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    gcc 3.3.3, no g++ executable.
    I use lfs, building from sources without customising.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HttpWebResponse Exceptions
    By Boomba in forum C# Programming
    Replies: 1
    Last Post: 01-03-2008, 12:43 PM
  2. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  3. Exceptions that should terminate. Really.
    By Mario F. in forum C++ Programming
    Replies: 7
    Last Post: 06-26-2007, 10:56 AM
  4. Need advice: catch exceptions or call methods to check bits?
    By registering in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2003, 01:49 PM
  5. Throwing exceptions with constructors
    By nickname_changed in forum C++ Programming
    Replies: 14
    Last Post: 07-08-2003, 09:21 AM