-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map.load() not getting any path #133
Comments
Are you debugging from within VS? Check the working directory (from memory it's |
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. |
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 ! |
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) |
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. \
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? |
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 |
OK, glad that works! 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 You'll also need to build BOTH 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 HTH! 😁 |
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 |
I've tried installing tmxlite into a project I've created (I'm using Visual Studio 2022) and all the includes seem to work fine, but every time I try to load a map this way:
I get this in the console:
If I try to do the same in the ParseTest project and load an unexisting map, I get this, which makes sense because the directory doesn't exist:
It seems like the issue is that the file path goes missing at some point, but I can't keep track of where it happens since the Map.cpp file isn't in the include files and I don't know how to add a breaking point to an external file.
I was wondering if I messed up the installation or something, since had a hard time generating the .libs and .dlls of the library. I also tried using the .libs and .dlls of a project where tmxlite worked fine, but I still had the same issue, so I don't really know what's causing it.
The text was updated successfully, but these errors were encountered: