Compiling OpenTTD

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Simkid wrote:Now I'm having a new problem, and still haven't managed to get OTTD to compile succesfully. I've reinstalled all components, and checked my paths, but now I'm getting a mass of syntax errors in winnt.h and winbase.h, and really have no idea why. I could post the build log if anyone wants it, but here's a sample of the first few errors to appear.

Code: Select all

C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(222) : error C2061: syntax error : identifier 'PVOID64'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(222) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(5940) : error C2061: syntax error : identifier 'PVOID64'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(5942) : error C2059: syntax error : '}'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(5056) : error C2146: syntax error : missing ')' before identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(5056) : error C2081: 'FILE_SEGMENT_ELEMENT' : name in formal parameter list illegal
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(5056) : error C2061: syntax error : identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(5056) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(5056) : error C3409: empty attribute block is not allowed
The Directx 8 include directory must be the last entry then it works.
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

gigajum wrote:
Hazelrah wrote:Sorry gigajum,
...
gigajum wrote:...

....
-Hazelrah
Lol, it looks like i did express myself a bit wrong. I had to look up some things on a german win2k version. I have no idea what's the correct english translation. Also i have VS8 running, it is only not configured, that is all.

There are svn command-line binaries for windows. Download them, and move them into a directory which is listed in you %path% variable. And try to compile openttd again. http://subversion.tigris.org/files/docu ... -1.3.2.zip

that link should be the right to the win32 command line files for svn.

i hope i expressed myself better this time :?
i tried it myself and got "OpenTTd norev000" so it looks as it does not work under MSVS8 or MSVC++2005.
Hazelrah
Traffic Manager
Traffic Manager
Posts: 196
Joined: 13 Apr 2005 05:41

Post by Hazelrah »

Yeah, that's kind of what I figured.

I still say there has to be a way to /D a string, not just an array of individual characters. In the end they're both the same to C!

-Hazelrah
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

But why is that version number so important on custom builds?

I looked at the linux Makefile and the version number is generated that way:

Code: Select all

ifdef RELEASE
REV:=$(RELEASE)
else
ifeq ($(shell if test -d .svn; then echo 1; fi), 1)
REV_MODIFIED := $(shell svnversion . | sed -n 's/.*\(M\).*/\1/p' )
REV := $(shell LC_ALL=C svn info | awk '/^URL:.*branch/ { BRANCH="-"a[split($$2, a, "/")] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
endif
endif
To get that working like under linux you need a sed.exe, a awk.exe and then write that into rev.c. Then add in your vs8 project file an VCPreBuildEventTool (see lang project files for more infos) which creates your rev.c
:) For the problem with the executables take a look at http://unxutils.sourceforge.net/

This is only an idea how to get it working under windows!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Hazelrah wrote:Thanks DaleStan. Since you reminded me what I was looking for I gave it another try.
Well, I've never actually done this (I usually use the "#define in network.h" trick), but let's see.

*poke* *prod*

You're not escaping the double quote symbols; the /D you need is:

Code: Select all

/D "WITH_REV_HACK=\"whatever\""
It will also work without the outer double quotes:

Code: Select all

/D WITH_REV_HACK=\"whatever\"
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
Miranda
Engineer
Engineer
Posts: 11
Joined: 16 Sep 2006 21:23

Post by Miranda »

I have the same problem as Simkid had, only I can't seem to fix it, not by reinstalling the PSDK, not by changing the order in which the dx lib/include files are in the list.... frankly, not by anything so far :)

Could anyone give me some more info on this?

The errors are all the same, for lots and lots of different compiled .c files, they are all this:

Code: Select all

C:\Program Files\Microsoft Platform SDK\Include\winnt.h(222) : error C2061: syntax error : identifier 'PVOID64'
C:\Program Files\Microsoft Platform SDK\Include\winnt.h(222) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK\Include\winnt.h(5940) : error C2061: syntax error : identifier 'PVOID64'
C:\Program Files\Microsoft Platform SDK\Include\winnt.h(5942) : error C2059: syntax error : '}'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C2146: syntax error : missing ')' before identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C2081: 'FILE_SEGMENT_ELEMENT' : name in formal parameter list illegal
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C2061: syntax error : identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C3409: empty attribute block is not allowed
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5056) : error C2059: syntax error : ','
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5060) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C2146: syntax error : missing ')' before identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C2081: 'FILE_SEGMENT_ELEMENT' : name in formal parameter list illegal
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C2061: syntax error : identifier 'aSegmentArray'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C3409: empty attribute block is not allowed
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5067) : error C2059: syntax error : ','
C:\Program Files\Microsoft Platform SDK\Include\winbase.h(5071) : error C2059: syntax error : ')'
Thanks for your time :)
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Latest (Vista/Longhorn) Microsoft Platform SDK v6.0

Post by boekabart »

With the latest Win32 Platform SDK you may (will) get this error, at least in 0.5.0.RC5 but most probably also in trunk.

Code: Select all

c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5185) : error C2365: 'SORT_DESCENDING' : redefinition; previous definition was 'enumerator'
        e:\bart\mydevs\mysvn\openttd\050_32plus\openttd.h(544) : see declaration of 'SORT_DESCENDING'
c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5185) : error C2086: 'tagSORTDIRECTION SORT_DESCENDING' : redefinition
        c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5185) : see declaration of 'SORT_DESCENDING'
c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5187) : error C2365: 'SORT_ASCENDING' : redefinition; previous definition was 'enumerator'
        e:\bart\mydevs\mysvn\openttd\050_32plus\openttd.h(543) : see declaration of 'SORT_ASCENDING'
c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5187) : error C2086: 'tagSORTDIRECTION SORT_ASCENDING' : redefinition
        c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5187) : see declaration of 'SORT_ASCENDING'
The reason is that openttd doesn't define a win32 target platform, so the sdk will default it to 'latest supported' which is Vista/IE7. In this case, there is a conflict between Openttd.h and the SDK.

For this reason, plus that we don't want to target Vista but 'win98 and up' (i guess), we should define WINVER, _WIN32_WINNT, _WIN32_IE_ and NTDDI_VERSION defines.

Proposed patch: Insert following code before WIN32_LEAN_AND_MEAN in stdafx.h:

Code: Select all

// Set the win32 target platform:
# define _WIN32_WINNT 0x0500 //Win2000
# define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+)
# define WINVER 0x0400 // NT4 == 98
# define NTDDI_VERSION 0x05000400 //Win2000 SP4
// end set the win32 target platform
For completeness, all the defines as found in latest sdkddkver.h:

Code: Select all

//
// _WIN32_WINNT version constants
//
#define _WIN32_WINNT_NT4                    0x0400
#define _WIN32_WINNT_WIN2K                  0x0500
#define _WIN32_WINNT_WINXP                  0x0501
#define _WIN32_WINNT_WS03                   0x0502
#define _WIN32_WINNT_LONGHORN               0x0600

//
// _WIN32_IE_ version constants
//
#define _WIN32_IE_IE20                      0x0200
#define _WIN32_IE_IE30                      0x0300
#define _WIN32_IE_IE302                     0x0302
#define _WIN32_IE_IE40                      0x0400
#define _WIN32_IE_IE401                     0x0401
#define _WIN32_IE_IE50                      0x0500
#define _WIN32_IE_IE501                     0x0501
#define _WIN32_IE_IE55                      0x0550
#define _WIN32_IE_IE60                      0x0600
#define _WIN32_IE_IE60SP1                   0x0601
#define _WIN32_IE_IE60SP2                   0x0603
#define _WIN32_IE_IE70                      0x0700

//
// IE <-> OS version mapping
//
// NT4 supports IE versions 2.0 -> 6.0 SP1
#define _WIN32_IE_NT4                       _WIN32_IE_IE20
#define _WIN32_IE_NT4SP1                    _WIN32_IE_IE20
#define _WIN32_IE_NT4SP2                    _WIN32_IE_IE20
#define _WIN32_IE_NT4SP3                    _WIN32_IE_IE302
#define _WIN32_IE_NT4SP4                    _WIN32_IE_IE401
#define _WIN32_IE_NT4SP5                    _WIN32_IE_IE401
#define _WIN32_IE_NT4SP6                    _WIN32_IE_IE50
// Win98 supports IE versions 4.01 -> 6.0 SP1
#define _WIN32_IE_WIN98                     _WIN32_IE_IE401
// Win98SE supports IE versions 5.0 -> 6.0 SP1
#define _WIN32_IE_WIN98SE                   _WIN32_IE_IE50
// WinME supports IE versions 5.5 -> 6.0 SP1
#define _WIN32_IE_WINME                     _WIN32_IE_IE55
// Win2k supports IE versions 5.01 -> 6.0 SP1
#define _WIN32_IE_WIN2K                     _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP1                  _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP2                  _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP3                  _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP4                  _WIN32_IE_IE501
#define _WIN32_IE_XP                        _WIN32_IE_IE60
#define _WIN32_IE_XPSP1                     _WIN32_IE_IE60SP1
#define _WIN32_IE_XPSP2                     _WIN32_IE_IE60SP2
#define _WIN32_IE_WS03                      0x0602
#define _WIN32_IE_WS03SP1                   _WIN32_IE_IE60SP2
#define _WIN32_IE_LONGHORN                  _WIN32_IE_IE70


//
// NTDDI version constants
//
#define NTDDI_WIN2K                         0x05000000
#define NTDDI_WIN2KSP1                      0x05000100
#define NTDDI_WIN2KSP2                      0x05000200
#define NTDDI_WIN2KSP3                      0x05000300
#define NTDDI_WIN2KSP4                      0x05000400

#define NTDDI_WINXP                         0x05010000
#define NTDDI_WINXPSP1                      0x05010100
#define NTDDI_WINXPSP2                      0x05010200

#define NTDDI_WS03                          0x05020000
#define NTDDI_WS03SP1                       0x05020100

#define NTDDI_LONGHORN                      0x06000000
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

Confirmed: also trunk does not compile with latest platform SDK .

Code: Select all

win32.cpp
c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5185) : error C2365: 'SORT_DESCENDING' : redefinition; previous definition was 'enumerator'
        e:\bart\mydevs\mysvn\openttd\orgtrunk\src\openttd.h(550) : see declaration of 'SORT_DESCENDING'
c:\program files\microsoft sdks\windows\v6.0\include\shobjidl.h(5187) : error C2365: 'SORT_ASCENDING' : redefinition; previous definition was 'enumerator'
        e:\bart\mydevs\mysvn\openttd\orgtrunk\src\openttd.h(549) : see declaration of 'SORT_ASCENDING'
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 12 guests