0

I get virtual function is not permitted on the decelartion for the function "getChildern" Virtual not permitted on data declarations

struct FieldsDataList : public ImplList<S3W::IFields, VarField, S3W::IField>
{
    void                            Clear();
    bool                            Remove(unsigned int id) ;
    virtual VarField*               CreateChild(unsigned int id) const ;
    virtual VarField&               GetInvalidItem() const ;


};


namespace S3W
{
    struct IField : S3W::IListItem
    {
        // double, unsigned int, wchar_t*, IGps*
        enum class Type { NONE = 0, UINT = 1, DOUBLE = 2, STRING = 3 };
        virtual double getDouble() const = 0;
        virtual unsigned int getUint()   const = 0;
        virtual const char*  getString() const = 0;
        virtual const char*  getKey() const = 0;
        virtual Type getType() const = 0;
        virtual ~IField() {}
        virtual FieldsDataList *   getChildern() = 0;
    };
    struct IFields : public S3W::IList<IField>
    {

    };

}

Here is the full error

2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2238: unexpected token(s) preceding ';'
2>  MainWindow.cpp
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2143: syntax error: missing ';' before '*'
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2433: 'S3W::IField::FieldsDataList': 'virtual' not permitted on data declarations
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
andre
  • 731
  • 2
  • 13
  • 27
  • 1
    Can you please copy-paste (as text) the *complete* error output, in full, including any possible informational notes, and without any editing? Also please try to create a [Minimal, Complete, and Verifiable Example](http://stackoverflow.com/help/mcve) to show us, where you use these classes. – Some programmer dude Mar 14 '17 at 12:19
  • 1
    If this is Visual Studio copy the text of the error message from the Output Tab instead of the Errors Tab. – drescherjm Mar 14 '17 at 12:21
  • I have pasted the full error – andre Mar 14 '17 at 12:23
  • 1
    I believe the problem is the compiler does not know about `FieldsDataList`. Perhaps if you included the header for that and you have a circular include path (which needs to be broken). Instead you probably should have instead used a forward reference. – drescherjm Mar 14 '17 at 12:27
  • Make sure if you include `FieldsDataList.h` in `IField.h` that `FieldsDataList.h` does not include `IField.h` otherwise you have a circular include path. If so this is a duplicate question. – drescherjm Mar 14 '17 at 12:31
  • @drescherjm That was the problem, circular include. Please post it as an answer – andre Mar 14 '17 at 12:32
  • BTW, I meant to say "forward declaration" in my above comment instead of "forward reference". – drescherjm Mar 14 '17 at 12:42

0 Answers0