Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile error when building Tilengine
#11
(12-17-2020, 01:50 AM)System64 Wrote: You have to download the right version of Visual Studio

Not necessarily. This happens whenever you open a project with a newer version of VS than the one in which the project was created. If you're using VS2019 -perfectly fine- retargetting is the way to go.
Reply
#12
(12-17-2020, 01:08 AM)megamarc Wrote: Hi,
Those errors are from libpng complaining about not finding zlib implementation. Putting zlib headers is one part of the solution, but there must be the actual library with zlib.lib or similar name. Sometimes libpng includes zlib bundled inside, others it doesn't, that depens on who is packaging libpng. In your case, seems that libpng you downloaded doesn't include it, so you must provide it externally.

Thanks, that was helpful. I downloaded http://gnuwin32.sourceforge.net/downlink...ib-zip.php and copied zlib.lib from that zip to Tilengine-master\src\libpng\Win32

When trying to build I still got some errors:

Build started...
1>------ Build started: Project: Tilengine, Configuration: Debug Win32 ------
1>Tilengine.vcxproj -> C:\Tilengine\Tilengine-master\src\Win32_Debug\Tilengine.dll
1>        1 file(s) copied.
1>The system cannot find the path specified.
1>        0 file(s) copied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(153,5): error MSB3073: The command "copy C:\Tilengine\Tilengine-master\src\Win32_Debug\Tilengine.dll C:\Tilengine\Tilengine-master\samples
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(153,5): error MSB3073: copy C:\Tilengine\Tilengine-master\src\Win32_Debug\Tilengine.lib C:\Tilengine\Tilengine-master\lib\Win32
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(153,5): error MSB3073:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(153,5): error MSB3073: :VCEnd" exited with code 1.
1>Done building project "Tilengine.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

But this was easily fixed by creating the folder C:\Tilengine\Tilengine-master\lib\Win32
Reply
#13
Next step... trying to build and run the test project in Tilengine.sln

Building was successful. I've copied all the required .dll's to the folder where test.exe is located (i.e. Tilengine-master\Debug)

I've also copied Tilengine-master\samples\assets to this same folder (i.e. Tilengine-master\Debug\assets)

When starting test.exe (from the command line) the program seems to hang with the following output:

Tilengine v2.8.5 32-bit built Dec 16 2020 17:59:09
Tilengine version 020805
Tilengine: Resource file not found
Tilengine: Resource file not found
Tilengine: Invalid Tilemap reference
Tilengine: Invalid object address is 00000000

Any idea?
Reply
#14
Hi,
Seems that assets path relative to the executable is mismatched. By default tilengine loads assets in the same directory as the executable. If they're on another place, you use TLN_SetLoadPath() function. Make sure that the call to this function -if any- matches with the path where you have your assets. Tilengine isn't finding the assets you try to load.
Reply
#15
This is from main.c in the test project (that I downloaded from github):

Code:
/* test layer */
tilemap = TLN_LoadTilemap("dummy", NULL);
for (c = 0; c < 2; c++)
{
TLN_SetLayer(0, NULL, tilemap);
if (tilemap == NULL)
tilemap = TLN_LoadTilemap("assets/sonic/Sonic_md_bg1.tmx", NULL);
}

The assets folder is in the same folder as the exectuable. I checked to see if the required asset is actually at the expected location and it is.

When I try to step into (F11) TLN_LoadTilemap("assets/sonic/Sonic_md_bg1.tmx", NULL) nothing happens and the process seems to hang.

Not sure why I can't even step into that function using the debugger in VS2019.
Reply
#16
Please note that I'm not writing my own code (yet). I'm just trying to compile and run the source code from Github as is, following the instructions from README.md
Reply
#17
Oh I understand, that test.c you found inside the /src directory is designed to validate automatic build status in Travis.ci when pushing to GitHub. It does several illegal operations in purpose, as kind of sanity checks, without even creating a window. So the behaviour you see is the expected one.

The sources you're interested on are located inside /samples folder
Reply
#18
Good to know about that test project.

Moving on to the samples. When I open Samples.sln (in the samples folder) and try to build I get the following compile error:

1>C:\Tilengine\Tilengine-master\samples\Simon.c(1,10): fatal error C1083: Cannot open include file: 'Tilengine.h': No such file or directory

So I changed "Additional Include Directories" from ..\..\include to ..\include

Then I got a linker error:

1>LINK : fatal error LNK1104: cannot open file 'Tilengine.lib'

So I changed "Additional Library Directories" from ..\..\lib to ..\lib

Then I could build successfully.

When I try to run I get a message about missing .dll's

I fixed this by copying the required dll's to the folder of the executable. When I run the executable (barrel.exe) a window is created that is red. In the console window I get a lot of error messages: "
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference
Tilengine: Invalid object address is 00000000
Tilengine: Invalid Palette reference"

etc.
Reply
#19
Yeah, you're right. The samples.sln VS solution and related projects are heaviliy outdated. They're based on an old VS2005 branch that had different directory structure. As I always use GNU makefiles to build the samples I forgot totally about them. Should be updated or removed.

Thanks for pointing this issue!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)