coelhudo
coelhudo

Reputation: 5080

Problems using Borland C++ compiler (version 5.5)

Declaration:

namespace a {
    namespace b {
        class Classe {
           public:
         Classe();
        };
    }
}

Definition:

#include "sample.h"

namespace a {
     b::Classe::Classe(){}
}

But with this definition I got this error:

Error E2038 .\sample.cpp 4: Cannot declare or define 'b::Classe::Classe()' here

Everything works fine when changing source to:

#include "sample.h"

namespace a {
     namespace b {
          Classe::Classe(){}
     }
}

How can I compile without change the whole code?

It's not my choice. In fact, I am a developer in a Linux environment, and I never thought that I would develop on Windows again. It's for a specific customer that only works with the Borland C++ compiler.

I found this wiki page from Embarcadero. It doesn't help much.


I give up. I'm doing what Remy said.

Upvotes: 2

Views: 1433

Answers (2)

aaz
aaz

Reputation: 5196

If all the declarations are in one block, you could try changing namespace b { } to struct b { };.

Upvotes: 0

Remy Lebeau
Remy Lebeau

Reputation: 597215

Try removing the namespace block in the .cpp file, and just qualify the entire constructor:

#include "sample.h"

a::b::Classe::Classe(){} 

Upvotes: 2

Related Questions