This is one of the common problems with compiling Rom in gcc4 due to tightening up what the compiler will let slip by as valid code. I originally posted this on MUD Planet.
These need to all be moved down to the end of the file, past the last struct that's defined here. Once you've moved them, all is well and your code will once again compile.
i remember this problem when i updated my compiler to gcc4, it made me annoyed by the simplicity of the required update. although, good coding practices ensued, so its all good :)
first off yes i am still alive lol just got buisy got enguaged etc so I dont have as much time as I ust to. secondly blagarglefangle gurgole *dead silence* well I realy dislike GCC4 ya its better but now I cant compile my already unstabole buggy code >_< lol I knew those problems where three and I knew they eventualy needed to be fixed I didnt know how to fix them and was glad when the GCC over looked them before now i need to figure out how to fix them before I can go on and improve the rest of my mud *sighs* I am tempted to actualy go get a stock copy of rom and just rip out the good code I liked from mine… its going to be suck a pain though X_X if only I was a way better coder lol
just update your existing code, take the time, research the errors the compiler gives you, you'll be better off for it.
ripping the code from your existing base into a stock base will just move the problems over. besides, once your gcc4, you just have to maintain the standard, if your on a server that updates the compiler when there are major compiler updates, then your code will stay up to day with the gcc standards, because the new problems it gives you will be quickly fixed apposed to fixing an entire base all at once, it should just be the simple things.
Personaly, i converted to gcc4 and did a g++ conversion at the same time, talk about a headache their :P but my mud is running better then ever, and frankly, i like it this way.
So my suggestion to you is to just update your existing code, or post the warnings/errors the compiler is givin you here, and the community will aid you in fixing, thats what we're here for :)
Actually as I recall, for stock 2.4b6 all that it wanted was the structure externs moved to the bottom of tables.h. It didn't require anything more than that.
People have a common habit of saying the compiler is broken when their code will no longer compile. I don't know how many times I've seen this posted over the years. It happened back in the day when gcc 3 came out. People complained. Certain clueless bonehead hosts called it bugware and refused to install it, even a couple of years after the fact. It happened again when gcc4 came along and it still hasn't gained complete acceptance.
The code most of us use is old. Much of it was written back in the mid to late 90s. It's expected that a lot of it will have problems due to sloppiness. As compilers mature, the standards are tightened up, and it's better for all of us. Mud code just tends to prefer to remain static for some reason. :)
Heh, people have a tendency to let shit roll downhill… Kind of amuses me. I remember when my host upgraded to gcc4, annoyed me for a bit, but it really didn't take long to get it to compile again. There usually aren't many "types" of issues, so it's mostly repeatative work.
lol well in my case I can guerentee its from slopyness funny thing is the code i have alteded and made myself works fine whats happened is all the extras I put in back when I was still realy crappy *as apost to just crappy* isent likething the GCC cas I had to cut a lot of corners to get it to work and dont rember what i did to alter it to make it work before. so I figure the best bet is to look at my list of improvements *i did keep one luckly* and just reinstall everything on a clean copy the right way so the whole thing is clean this time. also it gives me a chance to put in better code and ditch things like loups colour which I have found to take up more room then needed
I've corrected ohhh…about 100 errors and am nowhere near the end of the list its shooting at me since moving to a server with GCC4.
I'm not really a coder, I dabble in code…more of a tweaker…I'm at the point where I can install snippets and write some of my own (very)simple ones and this is driving me crazy.
I guess its like they say: What doesn't kill you makes you stronger. Just have to remember to walk AWAY from the light.
Had to go through this updating my friends code… It sucked, I hadn't done any programming for years and then he drops code in my face which didn't compile like it used to.. :p
In file included from act_comm.c:29: merc.h:5665: error: array type has incomplete element type merc.h:5666: error: array type has incomplete element type
In file included from act_comm.c:29: merc.h:5665: error: array type has incomplete element type merc.h:5666: error: array type has incomplete element type
This means the compiler has not seen a full definition of your array element types (in this case struct ss_type and struct ss_group_type) when you try to declare the arrays. The incomplete means it basically just knows there is such a type, but does not know the details (the layout and such), this is enough to make pointers to the type, but not enough info to make actual objects (the elements of the array in this case) as it does not know the size. The fix is just to have the definition of the structs before you declare the arrays. It should also be noted that the use of the struct type in these lines could very well be the incomplete declaration themselves, and this might have compiled before as these are extern declarations and not the actual definition, and the old compiler did not figure it needed the exact details to just know there is such an array someplace else.
11 Apr, 2009, Hades_Kane wrote in the 16th comment:
Votes: 0
*hugs having his own VPS and deciding what compiler he runs*
28 Jan, 2010, triskaledia wrote in the 17th comment:
Votes: 0
Probably an idiot question… But how do you know if you're running a gcc4, and what're the perks of upgrading to it if you dont?
gcc -v will tell you what version of gcc is set to standard…your Makefile is where you set the version of gcc to be used.
29 Jan, 2010, David Haley wrote in the 19th comment:
Votes: 0
Newer compiler versions are likely to fix bugs (although admittedly obscure ones), improve optimization, and add standards compliance. Depending on what kind of an upgrade you're talking about, they might include new standard library functions, or new GNU extensions.
It's relatively unlikely that you care as a typical MUD developer, to be honest. In fact, most of the warnings that the new compilers issue due to stricter standards compliance are hard to fix if you're not pretty well-tuned to what they mean.
If I remember right, didn't you have to move defines around in header files or something as well? To be compliant in GCC4 that is. There were a few things that were interesting.
tables.h
Find these:
These need to all be moved down to the end of the file, past the last struct that's defined here. Once you've moved them, all is well and your code will once again compile.