Thread overview
Namespace in header
May 06, 2003
Charl Marais
May 06, 2003
Jan Knepper
May 06, 2003
Charl Marais
May 09, 2003
Walter
May 06, 2003
Hi all

I'm trying to compile a very simple program from an example out of a book. Unfortunately, when I compile the header file, I get:

Error E2141 PromptModule.h 4: Declaration syntax error

with the code:

#ifndef PromptModuleH
#define PromptModuleH

namespace PromptModule        //where error occurs
{
    void PauseProgram();
}
#endif


If I take the namespace code out, it works fine. It also compiles the cpp file with namespace code in. I'm using Borland 5.5 compiler on windows XP.

Any help will be appreciated

thanks

Charl Marais


May 06, 2003
news://forums.inprise.com/borland.public.cppbuilder.commandlinetools

You should FORCE the compiler to process the HEADER file as C++ file with dmc -c -cpp PromptModule.h

More normal is including the .h file into a .cpp file.

ManiaC++
Jan



Charl Marais wrote:

> Hi all
>
> I'm trying to compile a very simple program from an example out of a book. Unfortunately, when I compile the header file, I get:
>
> Error E2141 PromptModule.h 4: Declaration syntax error
>
> with the code:
>
> #ifndef PromptModuleH
> #define PromptModuleH
>
> namespace PromptModule        //where error occurs
> {
>     void PauseProgram();
> }
> #endif
>
> If I take the namespace code out, it works fine. It also compiles the cpp file with namespace code in. I'm using Borland 5.5 compiler on windows XP.
>
> Any help will be appreciated
>
> thanks
>
> Charl Marais

May 06, 2003
Thanks


"Charl Marais" <NO__SPAM_maraischarl@hotmail.com> wrote in message news:b976lb$1kha$1@digitaldaemon.com...
> Hi all
>
> I'm trying to compile a very simple program from an example out of a book. Unfortunately, when I compile the header file, I get:
>
> Error E2141 PromptModule.h 4: Declaration syntax error
>
> with the code:
>
> #ifndef PromptModuleH
> #define PromptModuleH
>
> namespace PromptModule        //where error occurs
> {
>     void PauseProgram();
> }
> #endif
>
>
> If I take the namespace code out, it works fine. It also compiles the cpp file with namespace code in. I'm using Borland 5.5 compiler on windows XP.
>
> Any help will be appreciated
>
> thanks
>
> Charl Marais
>
>


May 09, 2003
"Charl Marais" <NO__SPAM_maraischarl@hotmail.com> wrote in message news:b976lb$1kha$1@digitaldaemon.com...
> Error E2141 PromptModule.h 4: Declaration syntax error

I'm afraid that's a borland compiler problem. The solution is to download the Digital Mars compiler from www.digitalmars.com/download/freecompiler.html