views:

219

answers:

2

With GCC 4.1.2, I get the error tmp.cpp:8: error: invalid function declaration for the following code

namespace edit {
  class A {
  public:
    void foo( );
  };
}

void edit:A::foo( ) {
}
A: 

The problem was easy to fix:

void edit:A::foo( ) {
         ^
    missing ':'

should be:

void edit::A::foo( ) {
Walter Nissen
You might consider deleting the question...
@STingRaySC: Questions with solutions are a good thing. This can only help and won't hurt anybody that comes later searching for that error message, so what good would it do to delete it?
sth
A: 

Syntax error, as that post said. Sometimes syntax errors leads to wrong error messages because of the parsing strategy, which is annoying.

SHiNKiROU