Hi everyone!
I have some problems with struct size defination and malloc()/free() .

Here is my code:
//-----------------------shaga.h----------------------
#define UNAME_MAXLEN 8
#define PWD_MAXLEN 8
#define Q_LINE_MAXLEN 512

enum _logtype{ shaga,syslog };
enum _onoff{ on,off };

struct _shaga{
        in_addr_t       db_host;
        u_short         db_port;
        char            db_name[Q_LINE_MAXLEN];
        char            db_user[UNAME_MAXLEN];
        char            db_pwd[PWD_MAXLEN];
        const           char *logfile[Q_LINE_MAXLEN];
        u_short         maxusers;
        _logtype        logtype;
        _onoff          enable_shaga;

}
struct Config{

        _shaga  shaga;
};

//////////////////////////////////////////////////
----------------------------------------shaga.c------------------------------------------------

#include "shaga.h"

int main(int argc, char *argv[]) {
        
 struct Config myConfig;
   return 0;
}


   return 0;
}
gcc -Wall shaga.c -o shaga ,then i get following error messages:

shaga.c: In function `main':
shaga.c:18: error: storage size of 'myConfig' isn't known

What does this mean? I think it is because  of the compiler don't know the
struct size.Am i wrong?
How can i solve this problem nicely?
Thanks in advance!

P.S. Please excuse me,if the question sounds very silly:)I'm a newbie in
c/c++ programming,and for my english,it is not my native;-)
-- 
View this message in context: 
http://www.nabble.com/storage-size-of-struct-isn%27t-known-tf4069554.html#a11564625
Sent from the C-prog mailing list archive at Nabble.com.

Reply via email to