Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ ROM
➜ Compiling the server
➜ act_comm errors compiling on ubuntu 9 with gcc 4.4.1
act_comm errors compiling on ubuntu 9 with gcc 4.4.1
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #15 on Tue 24 Nov 2009 12:23 AM (UTC) |
Message
| Just upload it somewhere and post the link to it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #16 on Tue 24 Nov 2009 12:27 AM (UTC) |
Message
| http://pdragon.homelinux.org/Rom24.tar.bz2 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #17 on Tue 24 Nov 2009 04:43 AM (UTC) |
Message
|
Not Found
The requested URL /Rom24.tar.bz2 was not found on this server.
Apache/2.2.12 (Ubuntu) Server at pdragon.homelinux.org Port 80
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #18 on Tue 24 Nov 2009 04:49 AM (UTC) |
Message
| opps lol i forgot one part of the url sorry
http://pdragon.homelinux.org/downloads/Rom24.tar.bz2 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #19 on Tue 24 Nov 2009 06:30 AM (UTC) 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:
to:
That gets rid of that error. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #20 on Tue 24 Nov 2009 06:56 AM (UTC) 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 | Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #21 on Tue 24 Nov 2009 06:57 AM (UTC) |
Message
| well i tryed that and it still not work
| Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #22 on Tue 24 Nov 2009 07:01 AM (UTC) |
Message
| well the
but it still tells me that it can not find it
| Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #23 on Tue 24 Nov 2009 08:17 AM (UTC) |
Message
| well i got the compile.h working now i have some bit.c errors | Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #24 on Tue 24 Nov 2009 08:23 AM (UTC) |
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
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #25 on Tue 24 Nov 2009 07:52 PM (UTC) |
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 | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #26 on Tue 24 Nov 2009 08:01 PM (UTC) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #27 on Tue 24 Nov 2009 08:26 PM (UTC) |
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 | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #28 on Tue 24 Nov 2009 10:07 PM (UTC) |
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 | Top |
|
Posted by
| Milo
USA (20 posts) Bio
|
Date
| Reply #29 on Wed 25 Nov 2009 12:54 AM (UTC) |
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$
| 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.
97,376 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top