elements of array have incomplete type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am getting the following error.  I do not understand why.

charlie: 18> g++ -c test.cpp
test.cpp:10: error: elements of array `A::MTWSCommands A::X::lvcCommands
[2]' have incomplete type
test.cpp:10: error: storage size of `A::X::lvcCommands' isn't known
test.cpp:7: error: storage size of `A::X::lvcCommands' isn't known

=====================================================================
charlie: 19> g++ --version
g++ (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.fc3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

======================================================================
Here is the test code :

test.h
=================================================================

#include <list>
using namespace std;
namespace A {
#define LVCCOMMANDS 1
    struct MTWSCmmands {
        const char *command;
        bool (*funct)(void);
    };
    class X {
        private:
            static struct MTWSCommands lvcCommands[LVCCOMMANDS + 1];
            bool validateStartRecord(void);
        public:
            X() {}
            ~X() {}
    };
}


test.cpp
=======================================================================
#include <sys/time.h>
#include <iostream>
#include "test.h"

using namespace std;
namespace A {
    struct MTWSCommands X::lvcCommands[LVCCOMMANDS + 1] = {
        { "START_RECORD" , validateStartRecord },
        { NULL           , NULL                }
    };
        
    bool X::validateStartRecord(void) {
        cerr << "validateStartRecord" << endl;
        return true;
    }
}

int main(int argc, char **argv) {
    struct timeval tv;
    struct timezone tz;

    gettimeofday(&tv, &tz);
    cout << tv.tv_sec << endl;
    cout << tv.tv_usec << endl;
    cout << tz.tz_minuteswest << endl;
    cout << tz.tz_dsttime << endl;
}


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux