C++ SFML和TMX错误
C++ SFML和TMX错误,c++,visual-studio,sfml,tiled,tmx,C++,Visual Studio,Sfml,Tiled,Tmx,我用SFML进行了我的第一场比赛,我犯了一些错误。当使用多个库来允许从平铺程序播放TMX文件时,就会出现这些错误。这个库包括:zlib、STP(sfmltmx解析器)、PugiXML #include <SFML/Graphics.hpp> #include <cstdlib> #include <cstdio> #include "STP/TMXLoader.hpp" #include "player.h" int main() { player
我用SFML进行了我的第一场比赛,我犯了一些错误。当使用多个库来允许从平铺程序播放TMX文件时,就会出现这些错误。这个库包括:zlib、STP(sfmltmx解析器)、PugiXML
#include <SFML/Graphics.hpp>
#include <cstdlib>
#include <cstdio>
#include "STP/TMXLoader.hpp"
#include "player.h"
int main()
{
player Gracz(50, 50, 50, 50, 32, 32, 5);
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML works!");
sf::RectangleShape rectangle;
rectangle.setSize(sf::Vector2f(Gracz.width, Gracz.height));
rectangle.setOutlineColor(sf::Color::Red);
rectangle.setOutlineThickness(5);
tmx::TileMap map("maps/map1.tmx");
map.ShowObjects();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
exit(0);
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
Gracz.changePos("up");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
Gracz.changePos("down");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
Gracz.changePos("left");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
Gracz.changePos("right");
}
window.clear();
// Drawing map
window.draw(map);
rectangle.setPosition(Gracz.x, Gracz.y);
window.draw(rectangle);
window.display();
}
return 0;
}
#包括
#包括
#包括
#包括“STP/TMXLoader.hpp”
#包括“player.h”
int main()
{
球员格拉茨(50,50,50,50,32,32,5);
sf::RenderWindow窗口(sf::VideoMode(640480),“SFML工作!”;
sf::矩形形状的矩形;
矩形.setSize(sf::Vector2f(Gracz.width,Gracz.height));
矩形.setOutlineColor(sf::Color::红色);
矩形。设置轮廓厚度(5);
TileMap映射(“maps/map1.tmx”);
ShowObjects();
while(window.isOpen())
{
sf::事件;
while(window.pollEvent(事件))
{
如果(event.type==sf::event::Closed)
window.close();
如果(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
出口(0);
如果(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
Gracz.changePos(“向上”);
如果(按下sf::键盘::isKeyPressed(按下sf::键盘::Down))则为else
Gracz.changePos(“向下”);
如果(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
Gracz.changePos(“左”);
如果(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
Gracz.changePos(“右”);
}
window.clear();
//制图
窗口。绘制(地图);
矩形设置位置(Gracz.x,Gracz.y);
窗口。绘制(矩形);
window.display();
}
返回0;
}
我想我可以做一些不好的事情,包括图书馆,但我不认为有问题。
我使用Visual Studio 2013作为IDE
我的错误:
Error 6 error LNK1120: 3 unresolved externals C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Debug\Titan Age.exe 1 1 Titan Age
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall tmx::TileMap::TileMap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0TileMap@tmx@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age
Error 5 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall tmx::TileMap::~TileMap(void)" (__imp_??1TileMap@tmx@@UAE@XZ) referenced in function _main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age
Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall tmx::TileMap::ShowObjects(bool)" (__imp_?ShowObjects@TileMap@tmx@@QAEX_N@Z) referenced in function _main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age
错误6错误LNK1120:3个未解析的外部C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Debug\Titan Age.exe 1 1 Titan Age
错误3错误LNK2019:未解析的外部符号“\uuuu declspec(dllimport)public:\uuuu thiscall tmx::TileMap::TileMap(类std::basic\u string const&”)”(\uuuuuuu imp??0TileMap@tmx@@QAE@ABV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@@std@@@Z)在函数\u main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age中引用
错误5错误LNK2019:未解析的外部符号“\uuu declspec(dllimport)public:virtual\uu thiscall tmx::TileMap::~TileMap(void)”(\uuu imp??1TileMap@tmx@@UAE@XZ)在函数\u main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age中引用
错误4错误LNK2019:未解析的外部符号“\uu declspec(dllimport)public:void\uuu thiscall tmx::TileMap::ShowObjects(bool)”(\uu imp\u0?ShowObjects@TileMap@tmx@@QAEX_N@Z)在函数\u main C:\Users\Artur1\documents\visual studio 2013\Projects\Titan Age\Titan Age\main.obj Titan Age中引用
谢谢您的帮助。您链接了tmx的dll了吗?您链接了tmx的dll了吗?