Comments (10)
Are you debugging from within VS? Check the working directory (from memory it's Project Properties -> Debugging -> Working Directory
) because your relative path resources/test.tmx
will be found starting from there.
from tmxlite.
Are you debugging from within VS? Check the working directory (from memory it's
Project Properties -> Debugging -> Working Directory
) because your relative pathresources/test.tmx
will be found starting from there.
My issue isn't that the path can't be found (I tried opening the file with fstream just to check and it loads correctly), it's that at some point when I call the load() method, the path ends up being an empty string, so the error in the console doesn't print any path, unlike in the ParseTest project.
from tmxlite.
Sorry, I misunderstood what you meant by 'file path goes missing'. That is weird, on the face of it, it looks impossible *
Lines 58 to 70 in 2ac3055
Can you set a breakpoint on the
map.load("resources/test.tmx");
line and then 'step into'? Can you share a complete (minimal) project where this happens? Potentially it could be some header/implementation mismatch, I'm not sure and maybe better wait until the experts show up!
* I've said this many times before !
from tmxlite.
Could possibly be a mismatch in debug/release builds? If you're not using any external libraries (zstd etc) you can easily add the source for tmxlite directly to your project, which will help setting break points (and remove any potential build config mismatching)
from tmxlite.
Sorry, I misunderstood what you meant by 'file path goes missing'. That is weird, on the face of it, it looks impossible *
Lines 58 to 70 in 2ac3055
Can you set a breakpoint on the
map.load("resources/test.tmx");
line and then 'step into'? Can you share a complete (minimal) project where this happens? Potentially it could be some header/implementation mismatch, I'm not sure and maybe better wait until the experts show up!
- I've said this many times before !
This is the project I'm working on. I can't set a breakpoint in Map.cpp because I'm using tmxlite as a dynamic library (at least I think that's what I did), so the .cpp is not in the same project.
\
Could possibly be a mismatch in debug/release builds? If you're not using any external libraries (zstd etc) you can easily add the source for tmxlite directly to your project, which will help setting break points (and remove any potential build config mismatching)
I could use the source files if I still can't get it to work, but since I've done it like that before (not me really, since it was a group project and I wasn't the one who installed the libraries), I thought I could do it the same way here.
from tmxlite.
I could use the source files if I still can't get it to work, but since I've done it like that before (not me really, since it was a group project and I wasn't the one who installed the libraries), I thought I could do it the same way here.
Ok, I couldn't try it until now and turns out I actually don't know how to use the source files (I thought I only had to copy and paste the tmxlite/src files into my project folder). Care if I ask how should I do it?
On the other hand, I'm sill trying to figure out how to install tmxlite as a dynamic library. I've checked this, this and this posts just in case. Since I'm on Windows, I can't completely follow the last one, and as far as I know, I've done the few things on the second one, but since I can't compile the tmxlite project nor the project generated with CMakeLists.txt in the tmxlite folder, I'm not sure if those libraries are completely functional.
from tmxlite.
The simplest way is to copy the src
and include
directories from the tmxlite folder to your project folder. Then (taking this random project I have as an example) right click Source Files
and Add Existing -> then select all the *.cpp
and *.c
files:
Then update your project properties to add the new include path:
Remember to update both Debug and Release builds, and remove any paths to the existing external library.
from tmxlite.
Thanks for the explanation! It seems to work if I use the source files, so I'm guessing I did something wrong when installing tmxlite as an external library, probably when generating the dlls. Correct me if I'm wrong, but all I had to do was use CMake to generate the project in CMakeLists.txt
and compile it, right? Because when I try to compile the ALL_BUILD
and ZERO_CHECK
projects, I get an error that says "Access denied", when I try to compile the INSTALL
one I get "The system couldn't find the specified file" and when I try to compile the tmxlite
project I ghet that "tmxlite.dll isn't a valid Win32 application". Any clues on why this is happening?
from tmxlite.
OK, glad that works!
So the first couple of errors, I can't really help with - there may be a bug in the Visual Studio build with CMake - I usually only use CMake for linux/mac etc. The last error is that the debugger is trying to launch and run the resulting dll - although it's not an exe so it throws that error.
There is a Visual Studio solution included with the tmxlite repository, which is what I usually work with, so you ought to have more luck with that. There are a few build options which might need explaining though, to get you off on the right foot.
Firstly, make sure you have the correct architecture selected for your project. By default the solution uses x64
but you'll need to change this if you're creating a 32-bit project. (Although unless you have a specific need for 32-bit I personally always choose x64 for everything)
You'll also need to build BOTH Debug
and Release
versions. This will create libtmxlite-d.lib/dll
and libtmxlite.lib/dll
respectively. You then also have to make sure to link the correct version to the correct build settings in your own project.
If you don't do this there won't be a compile error, but you will get strange runtime behaviour - and I suspect this is the source of your original bug (the missing file path).
It is also possible, using the configuration settings, to create a static library.
This will only compile to libtmxlite-s-d.lib/libtmxlite-s.lib
(no dll) and linking this will mean the tmxlite code is compiled into your executable as if you had included the source directly - there's no need to include any dll files.
HTH! 😁
from tmxlite.
Oh, yeah, I forgot to mention that I also tried with the solution in the repository. I got to generate the libraries (which I thought weren't the ones I needed because they were named libtmxlite.lib/dll
and not just tmxlite.lib/dll
as I had seen in other project). with no compilation errors, but I still got the "tmxlite.dll isn't a valid Win32 application" message for each of them.
If I try linking it to my existing project, I have the same issue and the file path ends up being an empty string. I also tried linking it to a new project just in case, but then I get an "Access violation reading location" compilation error from vcruntime140.dll
from tmxlite.
Related Issues (20)
- CAN SOMEONE JUST EXPLAIN HOW TO USE THIS HOT 9
- Problem with "std::localtime" in Log.hpp line 145 HOT 1
- meson.build version doesn't match git tags HOT 1
- Enough with the unsigned integers
- Find tmxlite on Windows HOT 4
- Feature Request: Allow independent parse of tsx to TileMap. HOT 2
- How hard would it be to adapt the library to render an isometric map? HOT 2
- Unable to start program. libtmxlite-s-d.lib is not a valid win32 application HOT 6
- When the camera zooms out, the animation speeds up HOT 1
- Not orthogonal and will not be shown HOT 3
- How to use tmxlite on Windows and CLion HOT 3
- Not a valid orthogonal layer, nothing will be drawn. HOT 3
- Failed opening tsx file for tile set
- I can't load every tsx file HOT 1
- test colission HOT 1
- i cant find example for rendering tilemap inSDL2 c++ HOT 1
- Anything against making MapLayer::Chunk public? HOT 3
- I have question HOT 2
- How to use Tmxlite on windows? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmxlite.