UnoffLandz / unoff-landz

open source server for the eternal lands/other life client
9 stars 4 forks source link

extern structs causing compile errors under C #69

Closed themuntdregger closed 9 years ago

themuntdregger commented 9 years ago

eg : struct attribute_ { int night_vision[MAX_PICKPOINTS]; int day_vision[MAX_PICKPOINTS]; int carry_capacity[MAXPICKPOINTS]; }; extern struct attribute attribute[MAX_RACES];

Causes error under GCC.

nemerle commented 9 years ago

Hmm... that's strange I'm not seeing any errors on gcc 4.9 ? What does it complain about ?

themuntdregger commented 9 years ago

I've also got 4.9 so sounds like something i'm doing wrong. However, for example, if I add extern to the client struct, I get:

||=== Build: server-debug in unoff-landz (compiler: GNU GCC Compiler) ===| .objs/Server/main.o||In function socket_accept_callback':| main.c|| undefined reference toclients'| main.c|| undefined reference to clients'| main.c|| undefined reference toclients'| .objs/Server/main.o||In function timeout_cb':| main.c|| undefined reference toclients'| .objs/Server/main.o||In function socket_read_callback':| main.c|| undefined reference toclients'| .objs/Server/main.o:main.c|| more undefined references to `clients' follow| ||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|

nemerle commented 9 years ago

Most likely you've not included all those .c files I've created, that are holding defined structs. In this example clients struct is defined in clients.c

themuntdregger commented 9 years ago

Aha - sorted

thx nemerle