C++ Exception class missing?

Hi

I tried googling about it and I couldn't really find a solid answer. Why is the compiler missing the exception class when it seems to be a standard class?

The code is here:

//Rijndael.h
 
#ifndef __RIJNDAEL_H__
#define __RIJNDAEL_H__
#include <exception>
#include <cstring>
using namespace std;
 
//Rijndael (pronounced Reindaal) is a block cipher, designed by Joan Daemen and Vincent Rijmen as a candidate algorithm for the AES.
//The cipher has a variable block length and key length. The authors currently specify how to use keys with a length
//of 128, 192, or 256 bits to encrypt blocks with al length of 128, 192 or 256 bits (all nine combinations of
//key length and block length are possible). Both block length and key length can be extended very easily to
// multiples of 32 bits.
//Rijndael can be implemented very efficiently on a wide range of processors and in hardware. 
//This implementation is based on the Java Implementation used with the Cryptix toolkit found at:
//http://www.esat.kuleuven.ac.be/~rijmen/rijndael/rijndael.zip
//Java code authors: Raif S. Naffah, Paulo S. L. M. Barreto
//This Implementation was tested against KAT test published by the authors of the method and the
//results were identical.
class CRijndael
{
public:
...
...
...
public:
    //CONSTRUCTOR
    CRijndael();
    //DESTRUCTOR
    virtual ~CRijndael();
    //Expand a user-supplied key material into a session key.
    // key        - The 128/192/256-bit user-key to use.
    // chain      - initial chain block for CBC and CFB modes.
    // keylength  - 16, 24 or 32 bytes
    // blockSize  - The block size in bytes of this Rijndael (16, 24 or 32 bytes).
    void MakeKey(char const* key, char const* chain, int keylength=DEFAULT_BLOCK_SIZE, int blockSize=DEFAULT_BLOCK_SIZE);
private:
    //Auxiliary Function
    void Xor(char* buff, char const* chain)
    {
        if(false==m_bKeyInit)
            throw exception(sm_szErrorMsg1);
        for(int i=0; i<m_blockSize; i++)
            *(buff++) ^= *(chain++);    
    }

And the error when trying to compile:

Rijndael.h: In member function 'void CRijndael::Xor(char*, const char*)':
Rijndael.h:78: error: no matching function for call to 'std::exception::exception(const char*&)'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception:57: note: candidates are: std::exception::exception()
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception:55: note: 

anyone run into a similar issue? is my gcc missing the exception class? it is
gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)

Thanks for your help

Do you have using namespace std; anywhere in your code? Without that you might need to do std::exception

yes, it is under the includes.

any ideas?

What is sm_szErrorMsg1 ? I don't think you can directly throw strings into an exception like that. Integers probably, and classes derived from the exception class, but not raw strings.

thanks, i removed it and it seems to bypass that error. however many more came out and i guess i will slowly debug each of them.

just a side thing, i grabbed the code verbatim from Downloads: A C++ Implementation of the Rijndael Encryption/Decryption method - CodeProject

i dont understand why a highly rated article has code that is not able to be used right out of the box? anyone have a better (working) implementation of Rijndael?

That code was written for Microsoft Windows in Visual C++ 6, and Microsoft compilers and libraries tend to have many nonstandard features and extensions. Portably-written code will usually compile in a Microsoft compiler, but programmers who don't know better can make code written in Microsoft compilers very hard to port. Things like this:

for(int i=0; i<10; i++) { ... }

Declaring variables inside a for-loop like this used to be a nonstandard feature, and caused many headaches for programmers trying to port code written in Visual C++.

You can find Rijndael(i.e. AES) encryption algorithms inside the source code for OpenSSL.