Arthur Tumanyan asked:
> Hi everyone!
> I have some problems with struct size defination and malloc()/free() .
Modified code:
//-----------------------shaga.h----------------------
#include <netinet/in.h> // in_addr_t
#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;
}; // Missing ; <-----------------
struct Config{
_shaga shaga;
};
//----------------------------------------shaga.c------------------------------------------------
#include "shaga.h"
int main(int argc, char *argv[]) {
struct Config myConfig;
return 0;
}
// The code should stop here.
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;-)
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/c-prog/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/