C++ Eclipse error class mynamespace::mynamespace

Posted by user2969329 on Stack Overflow See other posts from Stack Overflow or by user2969329
Published on 2013-11-08T15:34:52Z Indexed on 2013/11/08 15:54 UTC
Read the original article Hit count: 202

Filed under:
|

I'm new to C++, coming from a Java and web programming background. I specified a header file, with class definition. The class and the namespace have the same name. I do not know if that causes this issue, eclipse is very unspecific. Here is the World.h file:

`/*
 * World.h
 *
 *  Created on: 5 nov. 2013
 *      Author: Mo
 */

#ifndef WORLD_H_
#define WORLD_H_

#include "../../lib/tinyxml/tinyxml.h"
#include "Layer.h"

namespace World {

    class World {
    private:
        Layer layers[];
    public:
        World();
        virtual ~World();
        TiXmlElement toXML();
    };

} /* namespace World */
#endif /* WORLD_H_ */`

The error occurs in the class definition. The only thing eclipse shows is:

            class World::World

I have been googling for the last day and a half, and haven't found anything similar. In other classes, World is not seen as a type: "World" does not name a type.

What have I done wrong? Help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about c++

Related posts about eclipse