How to build strgen

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
MadEgg
Engineer
Engineer
Posts: 72
Joined: 08 Mar 2004 12:51
Location: Netherlands
Contact:

How to build strgen

Post by MadEgg »

How can I build strgen on Linux? Does it compile at all anyway? I tried to do it manually but I get this error:

Code: Select all

$ gcc strgen.cpp
strgen.cpp:81: error: `noreturn' was not declared in this scope
strgen.cpp:81: error: variable or field `_declspec' declared void
strgen.cpp:81: error: syntax error before `(' token
strgen.cpp:84: error: `s' was not declared in this scope
strgen.cpp:84: error: ISO C++ forbids declaration of `__builtin_va_start' with
   no type
strgen.cpp:84: error: declaration of `int __builtin_va_start'
strgen.cpp:84: error: conflicts with built-in declaration `void
   __builtin_va_start(char*&, ...)'
strgen.cpp:84: error: initializer list being treated as compound expression
strgen.cpp:85: error: `buf' was not declared in this scope
strgen.cpp:85: error: `s' was not declared in this scope
strgen.cpp:85: error: ISO C++ forbids declaration of `vsprintf' with no type
strgen.cpp:85: error: `int vsprintf' redeclared as different kind of symbol
/usr/include/stdio.h:345: error: previous declaration of `int vsprintf(char*,
   const char*, char*)'
strgen.cpp:85: error: initializer list being treated as compound expression
strgen.cpp:86: error: ISO C++ forbids declaration of `__builtin_va_end' with no
   type
strgen.cpp:86: error: declaration of `int __builtin_va_end'
strgen.cpp:86: error: conflicts with built-in declaration `void
   __builtin_va_end(char*&)'
strgen.cpp:86: error: invalid conversion from `char*' to `int'
strgen.cpp:87: error: `buf' was not declared in this scope
strgen.cpp:87: error: ISO C++ forbids declaration of `fprintf' with no type
strgen.cpp:87: error: `int fprintf' redeclared as different kind of symbol
/usr/include/stdio.h:322: error: previous declaration of `int fprintf(FILE*,
   const char*, ...)'
strgen.cpp:87: error: initializer list being treated as compound expression
strgen.cpp:88: error: ISO C++ forbids declaration of `exit' with no type
strgen.cpp:88: error: `int exit' redeclared as different kind of symbol
/usr/include/stdlib.h:612: error: previous declaration of `void exit(int)'
strgen.cpp:89: error: parse error before `}' token
strgen.cpp: In function `void put_byte(unsigned char)':
strgen.cpp:98: error: `error' undeclared (first use this function)
strgen.cpp:98: error: (Each undeclared identifier is reported only once for
   each function it appears in.)
strgen.cpp: In function `void EmitSetX(char*, int)':
strgen.cpp:157: error: `error' undeclared (first use this function)
strgen.cpp: In function `void EmitSetXY(char*, int)':
strgen.cpp:165: error: `error' undeclared (first use this function)
strgen.cpp: In function `void parse_strings_h(char*, FILE*)':
strgen.cpp:435: error: `error' undeclared (first use this function)
strgen.cpp: In function `void gen_output(FILE*)':
strgen.cpp:548: error: `error' undeclared (first use this function)
strgen.cpp: In function `int main(int, char**)':
strgen.cpp:568: error: `error' undeclared (first use this function)
$
Protect the Banana
MadEgg
Engineer
Engineer
Posts: 72
Joined: 08 Mar 2004 12:51
Location: Netherlands
Contact:

Post by MadEgg »

I now tried to build it using Visual C++ 6.0 on Windows, which went fine. I now got a strgen.exe but when I run it it complains about not being able to open strings.h.
It is actually in the same directory as the strgen.exe but isn't it supposed to be compiled into the executable anyway?

Or is there any place I can get a prebuild strgen.exe which I can use to compile the translation of english.txt into some .lng file?
Protect the Banana
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

MadEgg wrote:I now tried to build it using Visual C++ 6.0 on Windows, which went fine. I now got a strgen.exe but when I run it it complains about not being able to open strings.h.
It is actually in the same directory as the strgen.exe but isn't it supposed to be compiled into the executable anyway?

Or is there any place I can get a prebuild strgen.exe which I can use to compile the translation of english.txt into some .lng file?
strgen looks in the table subdirectory for strings.h

Code: Select all

parse_strings_h("table/strings.h", NULL);
So unless you move strgen.exe 1 directory up to main so that strings.h is in the table subdirectory, or modify strgen.cpp file to look for strings.h somewhere else, it won't run.

Of course you can run strgen.exe from the main openttd directory like this so that current directory is main openttd:

Code: Select all

strgen\Release\strgen.exe
Full:

Code: Select all

C:\Documents and Settings\<username>\Desktop\openttd-0.1>strgen\Release\strgen.exe
Good luck
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."
User avatar
Saskia
Director
Director
Posts: 523
Joined: 22 Feb 2004 14:23
Location: Cologne, Germany
Contact:

Post by Saskia »

And on Linux it's unusuable? :o
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Saskia wrote:And on Linux it's unusuable? :o
I have no idea. He tried to compile it under Linux, and failed. Then he tried it under windows, so I helped him on the way. I've got no idea about linux :)
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."
MadEgg
Engineer
Engineer
Posts: 72
Joined: 08 Mar 2004 12:51
Location: Netherlands
Contact:

Post by MadEgg »

Ok, thanks. That works.

I found out it is also hardcoded to an inputfile and an output file(english.txt and english.lng). Anyway, I got it to work, so great.

I'll try to get some command line arguments in to make it a bit more flexible :)
Protect the Banana
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

MadEgg wrote:Ok, thanks. That works.

I found out it is also hardcoded to an inputfile and an output file(english.txt and english.lng). Anyway, I got it to work, so great.

I'll try to get some command line arguments in to make it a bit more flexible :)
MadEgg lookie here :D
http://www.tt-forums.net/viewtopic.php?t=6616

Why don't people read my posts? :wink:
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."
MadEgg
Engineer
Engineer
Posts: 72
Joined: 08 Mar 2004 12:51
Location: Netherlands
Contact:

Post by MadEgg »

I didn't read it cuz it was about VC and I don't want to use that :p
Anyway, thanks for pointing me to the code snippet, works fine.
Protect the Banana
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 30 guests