latest cvs compile error

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
burning shadow
Rookie
Posts: 32
Joined: Wed Aug 25, 2004 1:55 pm
Location: spb, ru
Contact:

latest cvs compile error

Post by burning shadow »

I can't compile zsnes using MSVC6. It shows errors with jma\portable.h about 'long can't be followed by long'. Removing all JMA related stuff allows to compile zsnes as usual.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

The CVS unfortunatly is never guranteed to compile anyway. What exact compile rror did it generate?
evilant
Rookie
Posts: 44
Joined: Thu Nov 11, 2004 5:06 am

Post by evilant »

Bahamut_ZERO_939 wrote:What exact compile rror did it generate?
The definitions of INT64 and UINT64 in jma\portable.h are not MSVC-friendly. In revisions 1.1-1.2 they look like this:

Code: Select all

typedef long long INT64;
typedef unsigned long long UINT64;
MSVC wants to see "__int64" instead of "long long". No doubt this is what the compiler was complaining about.

As a side note, some people here might be interested in POSH (Portable Open Source Header): http://www.bookofhook.com/poshlib/Overview.html
It is a header file which detects many different compilers, etc. It is easy to use, has no external dependencies, and the license is very liberal. It is probably overkill for ZSNES, but it might come in handy if you work on other cross-platform projects.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

It would be a lot easier if MSVC supported the C99 standard where long long was introduced.

I suspect that since ipher has no trouble compiling, he has a more up to date MSVC.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
evilant
Rookie
Posts: 44
Joined: Thu Nov 11, 2004 5:06 am

Post by evilant »

IIRC, MSVC6 was released a long time before 99 :)

I guess you will need the common gorp, something like:

Code: Select all

#ifdef _MSC_VER
typedef __int64 INT64;
typedef unsigned __int64 UINT64;
#else
typedef long long INT64;
typedef unsigned long long UINT64;
#endif
(I didn't test this, it might contain typos)
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Are you compiling this in Cygwin or MinGW/MSYS or are you using the VC project file?
tharos

Post by tharos »

it should compile using the vstudio-2003 compiler, as there is a binary at http://cvscompile.aep-emu.de dated to 11/28
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

using the 2003 compiler with VC6 isn't exactly... stable. I tried it before, and couldn't even compile ZSNES.

You might have better luck with it tho
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

I've always found it best to use MinGW/MSYS or Cygwin 's shell system with vcvars32.bat to load the VC tools. tends to work a lot better IMO.
evilant
Rookie
Posts: 44
Joined: Thu Nov 11, 2004 5:06 am

Post by evilant »

A few weeks ago I compiled wip sources with the freely available 2003 version of the MS compiler. I used the include and lib directories from MSVC6, but only for files not supplied with the 2003 compiler. I used the DirectX 9.0 SDK. It compiled fine and it seemed to work--but I didn't test the resulting binary much so I have no idea if it was stable.
burning shadow
Rookie
Posts: 32
Joined: Wed Aug 25, 2004 1:55 pm
Location: spb, ru
Contact:

Post by burning shadow »

Well, MSVC6 is not perfect, but I guess there's a way to deal with it somehow.. :)
burning shadow
Rookie
Posts: 32
Joined: Wed Aug 25, 2004 1:55 pm
Location: spb, ru
Contact:

Post by burning shadow »

Ok, I finally was able to compile latest cvs code with my good old msvc6 :)
If someone ever need this, here's what should be changed in sources:

jma\portable.h: replace "long long" with "__int64"

win\winlink.cpp: replace

Code: Select all

volatile __int64 copymaskRB = 0x001FF800001FF800LL;
volatile __int64 copymaskG = 0x0000FC000000FC00LL;
volatile __int64 copymagic = 0x0008010000080100LL;
volatile __int64 coef = 0x0066009a0066009aLL;
with

Code: Select all

volatile __int64 copymaskRB = 0x001FF800001FF800i64;
volatile __int64 copymaskG = 0x0000FC000000FC00i64;
volatile __int64 copymagic = 0x0008010000080100i64;
volatile __int64 coef = 0x0066009a0066009ai64;
zloader.c: replace "#include <unistd.h>" with "#include <io.h>"

To make it compile properly using mingw's make, edit makefile.ms in this way:

1. replace

Code: Select all

ifeq (${CROSS},no)
  TRUTH=
  DELETECOMMAND=del
  SLASH=\${BLAHBLAHBLAH}
endif
with

Code: Select all

#ifeq (${CROSS},no)
#  TRUTH=
#  DELETECOMMAND=del
#  SLASH=\${BLAHBLAHBLAH}
#endif
2. replace "}\*" with "}\\\*"

It should compile now. I hope I didn't forget anything.. :)
Post Reply