Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: LNK 2019 error 'unresolved external symbol' with tmxlite  (Read 1145 times)

0 Members and 1 Guest are viewing this topic.

fridout106

  • Newbie
  • *
  • Posts: 1
    • View Profile
LNK 2019 error 'unresolved external symbol' with tmxlite
« on: February 04, 2018, 04:41:06 am »
I am trying to compile the SFML example that came with tmxlite just as a starting to point to start using tmxlite for my Tiled maps.

I keep getting this error:

LNK2019   unresolved external symbol _mz_inflateInit referenced in function "bool __cdecl tmx::decompress(char const *,class std::vector<unsigned char,class std::allocator > &,int,int)" (?decompress@tmx@@YA_NPBDAAV?$vector@EV?$allocator@E@std@@@std@@hh@Z)

I'm using VS Community 2017.

I was getting other similar errors before I included the tmxlite source files so I'm assuming it is requiring another source file but I think I've included them all.

Here is my main:

#include "stdafx.h"
#include <SFML/Graphics.hpp>

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window/Event.hpp>

#include <tmxlite/Map.hpp>

#include "C:\Program Files (x86)\tmxlite\SFMLExample\src\SFMLOrthogonalLayer.hpp"

#include "FreeFuncs.cpp"
#include "ImageLayer.cpp"
#include "Map.cpp"
#include "miniz.c"
#include "Object.cpp"
#include "ObjectGroup.cpp"
#include "Property.cpp"
#include "TileLayer.cpp"
#include "Tileset.cpp"
#include "pugixml.cpp"

using namespace sf;

int main()
{
                RenderWindow window(VideoMode(800, 600), "SFML window");

                tmx::Map map;
                map.load("assets/demo.tmx");

                MapLayer layerZero(map, 0);
                MapLayer layerOne(map, 1);
                MapLayer layerTwo(map, 2);

                while (window.isOpen())
                {
                        Event event;
                        while (window.pollEvent(event))
                        {
                                if (event.type == Event::Closed)
                                        window.close();
                        }

                        window.clear(Color::Black);
                        window.draw(layerZero);
                        window.draw(layerOne);
                        window.draw(layerTwo);
                        window.display();
                }

        return 0;
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: LNK 2019 error 'unresolved external symbol' with tmxlite
« Reply #1 on: February 04, 2018, 08:19:28 am »
Ehrm, that's not how you use a library...
As soon as you include a *.cpp file, you're doing something wrong. Instead add them to your project.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/