exceptions

This is a discussion on exceptions within the Linux Programming forums, part of the Platform Specific Boards category; I have a c++ program which compiles with visual c++ .net 2003, but won't compile on linux with g++. The ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,590
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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,674
    <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, 11:43 AM
  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

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