Giter Club home page Giter Club logo

Comments (10)

fallahn avatar fallahn commented on September 24, 2024 2

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.

MrHallows avatar MrHallows commented on September 24, 2024 1

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.

fallahn avatar fallahn commented on September 24, 2024 1
  1. 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.

  2. 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.

MrHallows avatar MrHallows commented on September 24, 2024

I found that it's actually (somewhat) related to Issue #19.

@fallahn

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.

fallahn avatar fallahn commented on September 24, 2024

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.

MrHallows avatar MrHallows commented on September 24, 2024

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.

MrHallows avatar MrHallows commented on September 24, 2024

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.

fallahn avatar fallahn commented on September 24, 2024

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.

MrHallows avatar MrHallows commented on September 24, 2024

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:

  1. When the time comes to build a release version, libtmxlite-s-d.lib will simply need to be swapped out with libtmxlite-s.lib in the linker configuration, correct?
  2. 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.

MrHallows avatar MrHallows commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.