Comments (10)
You're very welcome! For reference when creating your own library you might check out my other project xygine - it started in exactly the same way and has been a labour of love for many years now :D
from tmxlite.
Good to know. And no worries; I've actually moved my project to VS2017 already, so the rest shouldn't be too bad. I'll give that a whirl and let you know if it works out. I appreciate all of your help thus far.
from tmxlite.
-
That is correct :) The difference between the debug and release versions is that they, in turn, link to different versions of Microsoft's C runtime - so this has to match up with your project when it's compiled.
-
Also correct. The source files for tmxlite are now already compiled and contained within the .lib file. The headers are required so your project knows what's contained within the lib. The linker will then pull out and link the pieces required from the library to your executable when it is compiled.
Happy to help!
from tmxlite.
I found that it's actually (somewhat) related to Issue #19.
My bad, Map was missing its move assignment / move constructor. I've updated the the repository and you can now do
_maps.emplace("map_name", tmx::Map());
or
_maps["map_name"] = tmx::Map();
I'm looking into it further to see if I can find anything. I am using SDL2, by the way.
from tmxlite.
The root cause of the problem is that the Map
class contains members which are non-copyable, specifically instances of unique_ptr
. However as these themselves should be default movable, default move construction and assignment should work fine. A quick google suggests that older versions of Visual Studio do not support defaulted move construction/assignment (see here) - which version of Visual Studio are you using?
from tmxlite.
Okay, interesting. I'm using Visual Studio 2013, unfortunately. I have the 2015 and 2017 editions, but they are not activated, as I cannot afford to purchase a license key.
I don't suppose you'd be aware of any way around this, would you? Perhaps a modification of the tmxlite code?
from tmxlite.
I've got Visual Studio 2017 up and running, but now I'm getting the following linker errors:
1> Creating library ..\OpalEngine2D\Debug\OpalEngine2D.lib and object ..\OpalEngine2D\Debug\OpalEngine2D.exp
1>Map.obj : error LNK2019: unresolved external symbol "public: __thiscall tmx::Property::Property(void)" (??0Property@tmx@@QAE@XZ) referenced in function "public: void __thiscall std::allocator<class tmx::Property>::construct<class tmx::Property>(class tmx::Property *)" (??$construct@VProperty@tmx@@$$V@?$allocator@VProperty@tmx@@@std@@QAEXPAVProperty@tmx@@@Z)
1>Map.obj : error LNK2019: unresolved external symbol "public: void __thiscall tmx::Property::parse(class pugi::xml_node const &)" (?parse@Property@tmx@@QAEXABVxml_node@pugi@@@Z) referenced in function "protected: void __thiscall tmx::Layer::addProperty(class pugi::xml_node const &)" (?addProperty@Layer@tmx@@IAEXABVxml_node@pugi@@@Z)
1>Map.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall tmx::ObjectGroup::parse(class pugi::xml_node const &)" (?parse@ObjectGroup@tmx@@UAEXABVxml_node@pugi@@@Z)
1>Map.obj : error LNK2019: unresolved external symbol "public: __thiscall tmx::Map::Map(void)" (??0Map@tmx@@QAE@XZ) referenced in function "public: void __thiscall CMap::LoadMap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?LoadMap@CMap@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Map.obj : error LNK2019: unresolved external symbol "public: bool __thiscall tmx::Map::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?load@Map@tmx@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall CMap::LoadMap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?LoadMap@CMap@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Map.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall tmx::TileLayer::parse(class pugi::xml_node const &)" (?parse@TileLayer@tmx@@UAEXABVxml_node@pugi@@@Z)
1>..\OpalEngine2D\Debug\OpalEngine2D.exe : fatal error LNK1120: 6 unresolved externals
1>Done building project "OpalEngine2D.vcxproj" -- FAILED.
I'm looking at my linker settings to ensure that I've set everything up properly, just in case.
from tmxlite.
It could be a linker configuration error. I usually build the static version of tmxlite and make sure to link tmxlite-s-d.lib in debug mode and tmxlite-s.lib in release builds. The compiler versions also have to match - so if you built tmxlite with VS2017 you'll also need to move your project to that too (it's a pain, I know, but can't be helped unfortunately)
from tmxlite.
Okay, so I've built both static versions of the debug and release builds, which created libtmxlite-s-d.lib
and libtmxlite-s.lib
, respectively. And it is officially running again, so thank you! I apologise in advance for the potentially stupid questions, but I've currently got my configuration set to All Configurations
and I've included the libtmxlite-s-d.lib
file (for obvious reasons). My questions are:
- When the time comes to build a release version,
libtmxlite-s-d.lib
will simply need to be swapped out withlibtmxlite-s.lib
in the linker configuration, correct? - When static libraries are used, only the associated header files need to be in the project directory, correct? That is, not the source files. (I have not had much experience using static libraries up to this point.)
from tmxlite.
Oh, okay. I'll keep that in mind for the day I can finally finish this project. ;)
Awesome! I was hoping to "trim the fat" where I can, so this ended up being beneficial in more ways than one. Needless to say, I'm working on a 2D engine and platformer game, so once I get my bearings on separating the two into different projects, it would be nice to build the engine as a static library for use with future projects. :)
Matt, thank you so much for all of your help and for writing/providing such a helpful tool. I truly appreciate it.
from tmxlite.
Related Issues (20)
- Tilesets not loading tiles HOT 5
- Problem with getLayerAs for const pointers HOT 6
- Can't find package when installing using vcpkg HOT 1
- 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
- map.load() not getting any path HOT 10
- 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
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.