Problem compiling GRFCodec

Get help, info, news and advice about the Transport Tycoon Deluxe patch.

Moderator: TTDPatch Moderators

Post Reply
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Problem compiling GRFCodec

Post by DaleStan »

How does one compile the GRFCodec source?
$ make
and
$ make grfcodec
both produce this output:

Code: Select all

info.h:67: error: `struct infowriter::box::<anonymous union>::boxsprite' invalid; an anonymous union can only have non-static data members
info.h:72: error: `struct infowriter::box::<anonymous union>::boxdata' invalid; an anonymous union can only have non-static data members
If I remove the union, GRFCodec compiles, but the linker fails with reams of text, mostly undefined operator new, operator delete, and ___gxx_personality_sj0.

The compiler errors are the same, and the linker errors superficially the same, for both Cygwin and (after patching) Linux.

My gcc versions are
$ gcc --version
gcc (GCC) 3.3.3 (cygwin special)
and
$ gcc --version
gcc (GCC) 3.2.3
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

This is a problem with gcc 3.x i believe, you have to give the union a name (and use that name everywhere)... i had that same problem when i tried to compile it, but i fixed it, i will see if i can find enough spare time to make a diff :)
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

No, grfcodec itself is faulty.

It gives exactly the same error on VS.NET. What I did is just move the struct decleration from the class outside of the class; and it all worked.

Don't forget though that you need ttdpal.h which is missing from the grfcodec source zip. It's only there in one of the earlies source files.

When running grfcodec there is also a delete() error with invalid heap. Best is to just comment that out.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

Darkvater wrote:No, grfcodec itself is faulty.
This might be the case, but with gcc < 3.x it compiles perfectly....
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Darkvater wrote:Don't forget though that you need ttdpal.h which is missing from the grfcodec source zip. It's only there in one of the earlies source files.
That's because make builds it for you now. make clean doesn't delete it though.
Darkvater wrote:When running grfcodec there is also a delete() error with invalid heap. Best is to just comment that out.
On this I beg to differ. Best is to find the offending delete, and fix it.

It's now compiling and linking (use g++ to link, not gcc), so once I get things running, I'll post a patch.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Aaaah. MSVC doesn't use the makefile so the files doesn't get created :)

And that delete was just weird. It seemed correct but every time resulted in invalid heap. So I asked patchman and he said that is possible because grfcodec is the biggest mess he has ever coded.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Post Reply

Return to “General TTDPatch”

Who is online

Users browsing this forum: No registered users and 3 guests