Miért nem fordul??

Fórumok

Helló,

egy kis segítséget kérnék CPP-ben járatos emberektől. Egy progit írok (egyetemi házi) de valamiért nem fordul és a Visual Studio hibaüzenetei nem igazán segítenek a hiba megoldásában. Van egy OutOfMemoryException.h nevű fájl, ez így néz ki:

#ifndef OUT_OF_MEMORY_EXCEPTION_H
#define OUT_OF_MEMORY_EXCEPTION_H

#include

class OutOfMemoryException: public std::exception
{
static const int MSG_LENGHT = 512;
char* msg;
public:
OutOfMemoryException(const char * reason){
msg = new char[MSG_LENGHT];
sprintf(msg,"OutOfMemoryException: %s", reason);
}
const char* what() const{
return msg;
}
}
#endif /*OUT_OF_MEMORY_EXCEPTION_H*/

Ebben elevielg van valami hiba, csak nem tudom hogy mi, ezt írja a VS:

1>c:\documents and settings\szati\my documents\visual studio 2005\projects\hazi8\hazi8\string.cpp(5) : error C2143: syntax error : missing ';' before 'using'
1>c:\documents and settings\szati\my documents\visual studio 2005\projects\hazi8\hazi8\outofmemoryexception.h(11) : error C2059: syntax error : 'inline function header'
1>c:\documents and settings\szati\my documents\visual studio 2005\projects\hazi8\hazi8\outofmemoryexception.h(11) : error C2143: syntax error : missing ';' before '{'
1>c:\documents and settings\szati\my documents\visual studio 2005\projects\hazi8\hazi8\outofmemoryexception.h(11) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\documents and settings\szati\my documents\visual studio 2005\projects\hazi8\hazi8\string.cpp(5) : error C2059: syntax error : ';'

A String.cpp amit említ azt én írtam és így néz ki az eleje:

#include "String.h"
#include
#include "OutOfMemoryException.h"

using namespace std;

namespace HomeMadeString
{
...

Szerintem a hiba a kivétel osztálybvan lessz valahol.

Előre is köszi a segítséget.
Üdv
Szati

Hozzászólások

A class lezarasanal hianyzik a pontosvesszo.

class A {
...
}; //<-- sic!

A hibajelzés teljesen jó. Mi az első?
"syntax error : missing ';' before 'using'"
Azaz hiányzik a ; az using elől. Mi van előtte? Az include. Ami micsoda? Makró. Tehát hol hiányzik a ;?
Az include-olt .h fájl végén...

(Ezt a ;-t én már annyiszor lehagytam, hogy ez az első amit megnézek, ha nem fordul. :) )

"...handing C++ to the average programmer seems roughly comparable to handing a loaded .45 to a chimpanzee."
-- Ted Ts'o