[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  ROM
. -> [Folder]  Compiling the server
. . -> [Subject]  act_comm errors compiling on ubuntu 9 with gcc 4.4.1
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: act_comm errors compiling on ubuntu 9 with gcc 4.4.1
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1  2 3  

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Wed 25 Nov 2009 07:46 AM (UTC)  quote  ]
Message
Well, this is telling you that mxp_support_flags has been declared two times with two different types at the lines given; you need to fix the declarations to be of the same type. First determine what the correct type is, then find the declaration with the wrong type and fix it.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Wed 25 Nov 2009 01:25 AM (UTC)  quote  ]
Message
ok here is the new errors i can get past


pdragon@EGNSystems:~/Rom24/src$ make
gcc -c -pipe -mcpu=pentium -march=pentium -rdynamic -W -O -Wall -Winline -Wpointer-arith -Wcast-align -gstabs+ -ggdb3   act_wiz2.c
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
act_wiz2.c: In function ‘do_auto_copyover’:
act_wiz2.c:415: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
act_wiz2.c: In function ‘list_mxp_flags’:
act_wiz2.c:2299: error: conflicting types for ‘mxp_support_flags’
tables.h:77: note: previous declaration of ‘mxp_support_flags’ was here
act_wiz2.c: In function ‘do_idle’:
act_wiz2.c:3630: warning: format not a string literal and no format arguments
act_wiz2.c: In function ‘do_copyover’:
act_wiz2.c:3961: warning: format not a string literal and no format arguments
act_wiz2.c: In function ‘copyover_recover’:
act_wiz2.c:4022: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result
make: *** [act_wiz2.o] Error 1
pdragon@EGNSystems:~/Rom24/src$
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Wed 25 Nov 2009 01:17 AM (UTC)  quote  ]
Message
well i got that fixed lol sorry
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Wed 25 Nov 2009 12:54 AM (UTC)  quote  ]
Message
ok here is the new errors i get


pdragon@EGNSystems:~/Rom24/src$ make
gcc -c -pipe -mcpu=pentium -march=pentium -rdynamic -W -O -Wall -Winline -Wpointer-arith -Wcast-align -gstabs+ -ggdb3   act_obj.c
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
In file included from act_obj.h:1,
                 from act_obj.c:35:
                 triggers.h:1: error: array type has incomplete element type
                 make: *** [act_obj.o] Error 1
                 pdragon@EGNSystems:~/Rom24/src$
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Tue 24 Nov 2009 10:07 PM (UTC)  quote  ]
Message
You can only do compile-time initialization with compile-time constants. The syntax is deceptive as it makes it look like it's doing fancier and potentially dynamic initialization, but really it's just compile-time.

Contrast with this code:


$ cat test.c
typedef unsigned long long int u_int64;
typedef int             bool;

#define FALSE    0
#define TRUE     1

extern  const   struct  flag_type area_flags;
extern  const   struct  flag_type sex_flags;
extern  const   struct  flag_type exit_flags;

struct flag_type
{
    char *name;
    u_int64 bit;
    bool settable;
};

struct flag_stat_type
{
    const struct flag_type *structure;
    bool stat;
};

const struct flag_stat_type flag_stat_table[] =
{
    /*  {   structure       stat    }, */
    {   &area_flags,     FALSE   },
    {   &sex_flags,      TRUE    },
    {   &exit_flags,     FALSE   },
    {   0,          0   }
};

int main()
{
    return 0;
}


In this case, the compiler knows (at compile time, or more accurately at link time) what the address of those structures is, and therefore can (at compile/link time) insert the address into the initialization list.

But it still doesn't compile, although this time for other reasons: the structs are declared as extern but don't actually exist:

$ gcc test.c
/tmp/cc0GQVkE.o:(.rodata+0x0): undefined reference to `area_flags'
/tmp/cc0GQVkE.o:(.rodata+0x8): undefined reference to `sex_flags'
/tmp/cc0GQVkE.o:(.rodata+0x10): undefined reference to `exit_flags'
collect2: ld returned 1 exit status
$ 

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (19,431 posts)  [Biography] bio   Forum Administrator
Date Tue 24 Nov 2009 08:26 PM (UTC)  quote  ]
Message
No. Same results.

Anyway, as I said, even with the word "const" not appearing in the file at all, it still does it. There is something more subtle happening.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Tue 24 Nov 2009 08:01 PM (UTC)  quote  ]

Amended on Tue 24 Nov 2009 08:02 PM (UTC) by Twisol

Message
Try this?


extern  const   struct  flag_type * const area_flags;
extern  const   struct  flag_type * const sex_flags;
extern  const   struct  flag_type * const exit_flags;


Hopefully that should const-ize the pointer, which is the value that's really going in the array initializer.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,431 posts)  [Biography] bio   Forum Administrator
Date Tue 24 Nov 2009 07:52 PM (UTC)  quote  ]
Message
Well this has me puzzled. This is a test program which reproduces the relevant parts:


typedef unsigned long long int u_int64;
typedef int             bool;

#define FALSE    0
#define TRUE     1

extern  const   struct  flag_type * area_flags;
extern  const   struct  flag_type * sex_flags;
extern  const   struct  flag_type * exit_flags;

struct flag_type
{
    char *name;
    u_int64 bit;
    bool settable;
};

struct flag_stat_type
{
    const struct flag_type *structure;
    bool stat;
};

const struct flag_stat_type flag_stat_table[] =
{
/*  {   structure       stat    }, */
    {   area_flags,     FALSE   },
    {   sex_flags,      TRUE    },
    {   exit_flags,     FALSE   },
    {   0,          0   }
};



Compiling that (gcc test.c) gives:


test.c:27: error: initializer element is not constant
test.c:27: error: (near initialization for ‘flag_stat_table[0].structure’)
test.c:28: error: initializer element is not constant
test.c:28: error: (near initialization for ‘flag_stat_table[1].structure’)
test.c:29: error: initializer element is not constant
test.c:29: error: (near initialization for ‘flag_stat_table[2].structure’)


Even if I get rid of every const (by doing a global change of "const" to "") I get the same error.

I tried adding in more const declarations here and there without success. Perhaps David Haley or some other C guru can cast some light on this?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Tue 24 Nov 2009 08:23 AM (UTC)  quote  ]
Message
ok so here is what i am getting now


gcc -c -pipe -mcpu=pentium -march=pentium -rdynamic -W -O -Wall -Winline -Wpointer-arith -Wcast-align -gstabs+ -ggdb3   bit.c
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
bit.c:50: error: initializer element is not constant
bit.c:50: error: (near initialization for ‘flag_stat_table[0].structure’)
bit.c:51: error: initializer element is not constant
bit.c:51: error: (near initialization for ‘flag_stat_table[1].structure’)
bit.c:52: error: initializer element is not constant
bit.c:52: error: (near initialization for ‘flag_stat_table[2].structure’)
bit.c:53: error: initializer element is not constant
bit.c:53: error: (near initialization for ‘flag_stat_table[3].structure’)
bit.c:54: error: initializer element is not constant
bit.c:54: error: (near initialization for ‘flag_stat_table[4].structure’)
bit.c:55: error: initializer element is not constant
bit.c:55: error: (near initialization for ‘flag_stat_table[5].structure’)
bit.c:56: error: initializer element is not constant
bit.c:56: error: (near initialization for ‘flag_stat_table[6].structure’)
bit.c:57: error: initializer element is not constant
bit.c:57: error: (near initialization for ‘flag_stat_table[7].structure’)
bit.c:58: error: initializer element is not constant
bit.c:58: error: (near initialization for ‘flag_stat_table[8].structure’)
bit.c:59: error: initializer element is not constant
bit.c:59: error: (near initialization for ‘flag_stat_table[9].structure’)
bit.c:60: error: initializer element is not constant
bit.c:60: error: (near initialization for ‘flag_stat_table[10].structure’)
bit.c:61: error: initializer element is not constant
bit.c:61: error: (near initialization for ‘flag_stat_table[11].structure’)
bit.c:62: error: initializer element is not constant
bit.c:62: error: (near initialization for ‘flag_stat_table[12].structure’)
bit.c:63: error: initializer element is not constant
bit.c:63: error: (near initialization for ‘flag_stat_table[13].structure’)
bit.c:64: error: initializer element is not constant
bit.c:64: error: (near initialization for ‘flag_stat_table[14].structure’)
bit.c:68: error: initializer element is not constant
bit.c:68: error: (near initialization for ‘flag_stat_table[15].structure’)
bit.c:69: error: initializer element is not constant
bit.c:69: error: (near initialization for ‘flag_stat_table[16].structure’)
bit.c:70: error: initializer element is not constant
bit.c:70: error: (near initialization for ‘flag_stat_table[17].structure’)
bit.c:71: error: initializer element is not constant
bit.c:71: error: (near initialization for ‘flag_stat_table[18].structure’)
bit.c:72: error: initializer element is not constant
bit.c:72: error: (near initialization for ‘flag_stat_table[19].structure’)
bit.c:73: error: initializer element is not constant
bit.c:73: error: (near initialization for ‘flag_stat_table[20].structure’)
bit.c:74: error: initializer element is not constant
bit.c:74: error: (near initialization for ‘flag_stat_table[21].structure’)
bit.c:75: error: initializer element is not constant
bit.c:75: error: (near initialization for ‘flag_stat_table[22].structure’)
bit.c:76: error: initializer element is not constant
bit.c:76: error: (near initialization for ‘flag_stat_table[23].structure’)
bit.c:77: error: initializer element is not constant
bit.c:77: error: (near initialization for ‘flag_stat_table[24].structure’)
bit.c:78: error: initializer element is not constant
bit.c:78: error: (near initialization for ‘flag_stat_table[25].structure’)
bit.c:79: error: initializer element is not constant
bit.c:79: error: (near initialization for ‘flag_stat_table[26].structure’)
bit.c:80: error: initializer element is not constant
bit.c:80: error: (near initialization for ‘flag_stat_table[27].structure’)
*** Error code 1

Stop.
pmake: stopped in /home/pdragon/Rom24/src

[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Tue 24 Nov 2009 08:17 AM (UTC)  quote  ]
Message
well i got the compile.h working now i have some bit.c errors
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Tue 24 Nov 2009 07:01 AM (UTC)  quote  ]
Message
well the

#include "compile.h"


but it still tells me that it can not find it

[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Tue 24 Nov 2009 06:57 AM (UTC)  quote  ]
Message
well i tryed that and it still not work
[Go to top] top

Posted by Nick Gammon   Australia  (19,431 posts)  [Biography] bio   Forum Administrator
Date Tue 24 Nov 2009 06:56 AM (UTC)  quote  ]

Amended on Tue 24 Nov 2009 06:57 AM (UTC) by Nick Gammon

Message
Well I can reproduce the problem:


typedef unsigned long long int u_int64;

#define REMOVE_BIT(var, bit)    ((u_int64)(var) &= ~(u_int64)(bit))
#define Ox          0x0000400000000000ULL

#define COMM_TIMESTAMP      (Ox)

int main (void)
  {
  u_int64     comm;

  REMOVE_BIT(comm,COMM_TIMESTAMP);
  }


This test program gives:


test.c:12: error: lvalue required as left operand of assignment


Not quite sure why.

However this compiles OK:


typedef unsigned long long int u_int64;

#define REMOVE_BIT(var, bit)    ((var) &= ~(u_int64)(bit))
#define Ox          0x0000400000000000ULL

#define COMM_TIMESTAMP      (Ox)

int main (void)
  {
  u_int64     comm;

  REMOVE_BIT(comm,COMM_TIMESTAMP);
  }


If you get rid of the casts in merc.h it compiles with much less errors:


#define SET_BIT(var, bit)   ((var) |= (u_int64)(bit))
#define TOGGLE_BIT(var, bit)    ((var) ^= (u_int64)(bit))
#define REMOVE_BIT(var, bit)    ((var) &= ~(u_int64)(bit))


After that is only one error (for this particular file) on this line:


    if (ch->pcdata->spousename && ch->pcdata->spousename[0] !='\0') sprintf(spouse,ch->pcdata->spousename);


Try changing that to:


    if (ch->pcdata->spousename && ch->pcdata->spousename[0] !='\0') sprintf(spouse, "%s", ch->pcdata->spousename);


I still get some errors after that, but this is at least past the part that was troubling you before.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,431 posts)  [Biography] bio   Forum Administrator
Date Tue 24 Nov 2009 06:30 AM (UTC)  quote  ]

Amended on Tue 24 Nov 2009 06:31 AM (UTC) by Nick Gammon

Message
Milo said:

i have tryed


#include <compile.h>
and yes when i tried it this way i did move a copy of the compile in the src folder 

and 

#include "../compile.h"




My first comment is, after looking at the source, that compile.h is in the *same* directory, so change:


#include "../compile.h"


to:


#include "compile.h"


That gets rid of that error.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Milo   USA  (17 posts)  [Biography] bio
Date Tue 24 Nov 2009 04:49 AM (UTC)  quote  ]
Message
opps lol i forgot one part of the url sorry

http://pdragon.homelinux.org/downloads/Rom24.tar.bz2
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,673 views.

This is page 2, subject is 3 pages long:  [Previous page]  1  2 3  [Next page]

[New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]