Need Help! Compiling under windows get ErrorLINK"libpng.lib"

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

User avatar
Paradoxon101
Engineer
Engineer
Posts: 11
Joined: 02 Apr 2012 18:34
Location: Germany
Contact:

Need Help! Compiling under windows get ErrorLINK"libpng.lib"

Post by Paradoxon101 »

Hello,
i try to compile OpenTTD on my windows. I use the visual studio 2010 express.

All compiles good but at the End i get a Error (LINK : fatal error LNK1181: cannot open input file "libpng.lib").

What can i do now?
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by FooBar »

Did you get the openttd-useful package and link it accordingly? From what I gather you either didn't get it at all, or you didn't link the VC++ directories properly.

These instructions may help: http://wiki.openttd.org/User:Roujin/Mic ... 2B%2B_2010
User avatar
Paradoxon101
Engineer
Engineer
Posts: 11
Joined: 02 Apr 2012 18:34
Location: Germany
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Paradoxon101 »

Thanks, this Wiki helps.

Now i can compile openttd but i get a error on start: "No available language packs (invalid versions?)".

Can you help me again plz?
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by FooBar »

If you didn't make the bundle, you need to gather the required files yourself and put them in the correct directory structure.

What should work is copy openttd.exe from the objs/Win32/Release folder to the bin folder where the rest is[0]. Then preferrably copy the entire bin folder to the place where you want to save this build, to avoid having it overwritten the next time you compile.


[0] Don't hold me to this, I always make the bundle.
User avatar
Paradoxon101
Engineer
Engineer
Posts: 11
Joined: 02 Apr 2012 18:34
Location: Germany
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Paradoxon101 »

I download the latest stable from here http://www.openttd.org/en/download-stable and replace the openttd.exe with the compiled one, but still the same error :(

Does this problem also has a wiki entry?
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by FooBar »

Yeah... I also didn't tell you to download the latest stable and replace the exe...

The language files of the stable are essentially a year old. It may work with a nightly, but it's still a silly approach. If you compiled the game, you also compiled the language files. You just need to find where they are.
User avatar
Paradoxon101
Engineer
Engineer
Posts: 11
Joined: 02 Apr 2012 18:34
Location: Germany
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Paradoxon101 »

Ok, sorry, it was only a trial.

Where can I adjust where the languages are created?
Attachments
folder.PNG
folder.PNG (6.15 KiB) Viewed 5959 times
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by FooBar »

I suppose in the vcproj file of the languages, but I have no idea. But if you move the languages, then you still have the other directories in the wrong place. So why don't you just copy the exe to the bin dir?
handrake
Engineer
Engineer
Posts: 55
Joined: 26 Mar 2012 10:23

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by handrake »

Paradoxon101 wrote:Ok, sorry, it was only a trial.

Where can I adjust where the languages are created?
You don't need to care about where they are created. This is what I do to bundle/execute after compiling is done. From openttd directory,

Code: Select all

 make -f Makefile.msvc bundle PLATFORM=WIN32; chmod +r -R *; cp -r bundle/* /cygdrive/d/openttd-bundle; /cygdrive/d/openttd-bundle/openttd 
(I use cygwin so path is in a slightly different format, but you get the idea.)
User avatar
Paradoxon101
Engineer
Engineer
Posts: 11
Joined: 02 Apr 2012 18:34
Location: Germany
Contact:

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Paradoxon101 »

FooBar wrote:So why don't you just copy the exe to the bin dir?
Thanks, that's solved the problem!

:mrgreen: :mrgreen: :mrgreen:
RedEclipse
Engineer
Engineer
Posts: 45
Joined: 19 Feb 2012 16:00

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by RedEclipse »

Hey guys,

Sorry for gravedig but got same problem. Once was successful and compiled game with a warning, but now constantly getting same error, warning:

Error 3 error LNK1181: cannot open input file 'libpng.lib' C:\Users\RedEclipse\Documents\OpenTTD Stuff\Trunk\projects\LINK
Warning 2 warning C4005: 'FACILITY_DIRECTMUSIC' : macro redefinition (..\src\music\dmusic.cpp) c:\users\redeclipse\documents\openttd stuff\openttd essentials\shared\include\dmerror.h 12 1 openttd

VS2013, also used this guide https://wiki.openttd.org/Compiling_on_W ... 2B%2B_2012

What I'm doing wrong?
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Supercheese »

RedEclipse wrote:Hey guys,

Sorry for gravedig but got same problem. Once was successful and compiled game with a warning, but now constantly getting same error, warning:

Error 3 error LNK1181: cannot open input file 'libpng.lib' C:\Users\RedEclipse\Documents\OpenTTD Stuff\Trunk\projects\LINK
Warning 2 warning C4005: 'FACILITY_DIRECTMUSIC' : macro redefinition (..\src\music\dmusic.cpp) c:\users\redeclipse\documents\openttd stuff\openttd essentials\shared\include\dmerror.h 12 1 openttd

VS2013, also used this guide https://wiki.openttd.org/Compiling_on_W ... 2B%2B_2012

What I'm doing wrong?
Well, the wiki has a solution for your second problem there: https://wiki.openttd.org/Compiling_on_W ... inition.22
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
RedEclipse
Engineer
Engineer
Posts: 45
Joined: 19 Feb 2012 16:00

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by RedEclipse »

I tried, unfortunately doesn't help.

EDIT:

just tried to link libpng.lib via AdditionalDependencies... Not sure if I did it properly, but nothing happened :\

winmm.lib;ws2_32.lib;imm32.lib;libpng.lib;zlibstat.lib;lzo2.lib;liblzma.lib;libfreetype2.lib;icuuc.lib;icuin.lib;icudt.lib;icule.lib;iculx.lib;C:\Users\RedEclipse\Documents\OpenTTD Stuff\OpenTTD Essentials\win32\library\libpng.lib;%(AdditionalDependencies)

EDIT2:

Figured out, found typo in Include directories. **** happens :shock:
Gigigonzalez
Engineer
Engineer
Posts: 91
Joined: 12 Jun 2014 14:24

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Gigigonzalez »

Really though, ive used both VS2010 and 2013, and i got these errors by default whenever i didnt include 'openttd essentials' include/library dirs. Got tired of adding manually everytime so i dumped the files in the default VS path dirs so they are always automagically found.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by TadeuszD »

I have problems with OTTD compilation on VS Express 2012 Update 4. :cry:
'Debug' configuration works. It generates ~230 linker warnings, but compiled application works fine.
But 'Release' configuration generates compiler internal error:

Code: Select all

7>  ...
7>  Generating code
7>d:\ottd\trunk\src\3rdparty\squirrel\squirrel\squtils.h(36): fatal error C1001: An internal error has occurred in the compiler.
7>  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 211)
7>   To work around this problem, try simplifying or changing the program near the locations listed above.
7>  Please choose the Technical Support command on the Visual C++ 
7>   Help menu, or open the Technical Support help file for more information
========== Rebuild All: 5 succeeded, 1 failed, 1 skipped ==========
The file squtils.h looks good... Anybody knows the solution of this problem?
Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Alberth »

Ask Microsoft to fix the compiler.

"internal error in the compiler" basically means the code you were compiling confused the compiler, and it crashed.

It's comparable to a situation where you type an english sentence in Word, and the editor crashes on it, because it fails to understand what you type. Unlike Word however, a compiler must truely understand what you type, since it has to trasnalate the input into a executable program.
Being a retired OpenTTD developer does not mean I know what I am doing.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by TadeuszD »

Alberth wrote:Ask Microsoft to fix the compiler..
Very funny... For me described situation looks like a joke... :|

Problematic file squtils.h is the part of library, which are not changed by OTTD developers. Or I'm wrong? I downloaded this library from https://wiki.openttd.org/Compiling_on_W ... d_software
Nobody received similar errors during OTTD compilation on Windows?
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by planetmaker »

TadeuszD wrote:
Alberth wrote:Ask Microsoft to fix the compiler..
Very funny... For me described situation looks like a joke... :|

Problematic file squtils.h is the part of library, which are not changed by OTTD developers. Or I'm wrong? I downloaded this library from https://wiki.openttd.org/Compiling_on_W ... d_software
Nobody received similar errors during OTTD compilation on Windows?
Not really a joke. Compiler errors do happen and it's not the first compiler error which OpenTTD uncovers or runs into. And it might well be that no-one uses the exact version of the compiler you use, so you might indeed be the first one to encounter it.

Asking Microsoft to fix the error is probably a good idea indeed. How would they know otherwise and fix it for future releases of MSVC?
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by Eddy Arfik »

TadeuszD wrote:I have problems with OTTD compilation on VS Express 2012 Update 4
Try updating to VS 2013 Express, it compiles 64bit release version for me without errors.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Need Help! Compiling under windows get ErrorLINK"libpng.

Post by TadeuszD »

Eddy Arfik wrote:Try updating to VS 2013 Express, it compiles 64bit release version for me without errors.
Thanks. I'll try. :wink:
Image
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 39 guests