vega-vc8: compilation error

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
Post Reply
Tc27
Trader
Trader
Posts: 22
Joined: Thu Jan 31, 2008 7:06 pm

vega-vc8: compilation error

Post by Tc27 »

VC8 doesn't seem to like svn-11820, cmd/basecomputer.cpp:3184, complaining about the implicit conversion involved in passing &datesort to scandir().

Changing both of datesort()'s parameters (line 3158) from "const void *" to "const struct dirent**" stops the compiler complaining; the basescreen load/save seems to behave ok when built this way, though the initial casts in datesort() become redundant.

The main menu's load game screen still appears to sort saves alphabetically, though...

(Incidentally, I notice that safemode's collider work has gone into trunk for testing, but there hasn't been an updated version of the vega-vc* project files to use the new code yet. Is testing under windows required?)
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Argh -- that really bugs me.
Here's the manpage on scandir in Linux
int(*compar)(const struct dirent **, const struct dirent **)

But when I compile using dirent** I get this message:
warning: invalid conversion from ‘int (*)(const dirent**, const dirent**)’ to ‘int (*)(const void*, const void*)’
Same thing happens on the Mac. I guess I need to do an ifdef _WIN32, or else accept that linux and mac will always have a warning there.

For the collide stuff you probably aren't going to be able to get it to compile in Windows today. I'll make it a point to boot up to windows tomorrow and get these problems solved.


Yes, I only fixed half the code. One of the load screens is written in Python, the other is in C++. So I still need to fix it.

-Patrick
Tc27
Trader
Trader
Posts: 22
Joined: Thu Jan 31, 2008 7:06 pm

Post by Tc27 »

Cheap hack of a solution...

I found scandir() is already declared in a win32 ifdef... so I changed the emulation function signature to match the way you say Linux is behaving.

Builds with no more than the usual number of warnings, save/load screen seems to work ok.

(TortoiseSVN-generated patch attached.)
You do not have the required permissions to view the files attached to this post.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I committed a different fix to svn since I forgot to check the forums.

I actually didn't realize that a WIN32 version of scandir was written directly in the code in vsfilesystem.cpp

It seems that the manpage and the actual system headers conflict, and I don't see any right way of doing this, so for now I just have a typedef.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I just added the new collide2 library to the VC++ projects.

Can you update and try compiling? I have not actually tested it in VC8 yet.
ZX81
Explorer
Explorer
Posts: 11
Joined: Sun Feb 10, 2008 10:06 pm
Location: Germany

Post by ZX81 »

I had problems too with scandir and with the "hack" in cstypes.h
but 11843 compiled like a charm with vc8 on win 32 :D
You do not have the required permissions to view the files attached to this post.
my box: ZX81, 1 kByte Ram + the big memory extension box w 16 kByte Ram and some other stuff
Post Reply