c++ - Linker Error 2019 without touching the linker properties? -


so i'm making game, , working fine, started developing next part of game chunking system , generation (you might able tell previous posts) of sudden got random linker errors, though haven't touched in linker , game working fine before. here errors:

error   3   error lnk2019: unresolved external symbol "public: class sf::sprite __thiscall abstractblock::draw(void)" (?draw@abstractblock@@qae?avsprite@sf@@xz) referenced in function _main   c:\(insert personal stuff here)\main.obj    top down shooter error   4   error lnk2019: unresolved external symbol "public: void __thiscall abstractblock::destroy(class b2world *)" (?destroy@abstractblock@@qaexpavb2world@@@z) referenced in function "public: int __thiscall universe::savegame(void)" (?savegame@universe@@qaehxz)  c:\(insert personal stuff here)\universe.obj    top down shooter error   5   error lnk1120: 2 unresolved externals 

they don't have line numbers , appears problem in universe.obj , main.obj? don't know are, instead i'm going post both of .cpp files in full:

universe.cpp:

#include "universe.h"  universe::universe(){      world = new b2world(b2vec2(0, 0));     world->setallowsleeping(false);      chunkmanager = new chunkmanager(world);      player = new player(world);   }   universe::~universe() { }  int universe::savegame(){     player->destroy(world);     player = nullptr;       std::list<abstractblock>::iterator i;      (i = getloadedblocks()->begin(); != getloadedblocks()->end(); i++){         i->destroy(world);     }      world = nullptr;     return 1; }  void universe::spawnentity(int x, int y, int entityid){  }  std::list<abstractblock>* universe::getloadedblocks(){     return chunkmanager->getloadedblocks(); }  void universe::update(){      player->update();      world->step(1 / 60.f, 8, 3); }  player* universe::getplayer(){     return player; } 

main.cpp:

#include <iostream> #include "box2d\box2d.h" #include "sfml/graphics.hpp" #include "universe.h" #include "simplexnoise.h"  int main(){      static int fps = 1.f / 60.f;      sf::renderwindow window(sf::videomode(640, 480), "top down shooter");     sf::event event;      universe universe;      bool running = true;     int distx;     int disty;     float angle;      while (running){          window.clear(sf::color::white);          while (window.pollevent(event)){             switch (event.type){             case sf::event::closed:                 running = false;                 break;             case sf::event::keypressed:                 switch (event.key.code){                 case sf::keyboard::q:                     running = false;                     break;                 case sf::keyboard::w:                     universe.getplayer()->setmoveup(true);                     break;                 case sf::keyboard::a:                     universe.getplayer()->setmoveleft(true);                     break;                 case sf::keyboard::d:                     universe.getplayer()->setmoveright(true);                     break;                 case sf::keyboard::s:                     universe.getplayer()->setmovedown(true);                     break;                 }                 break;             case sf::event::keyreleased:                 switch (event.key.code){                 case sf::keyboard::w:                     universe.getplayer()->setmoveup(false);                     break;                 case sf::keyboard::a:                     universe.getplayer()->setmoveleft(false);                     break;                 case sf::keyboard::d:                     universe.getplayer()->setmoveright(false);                     break;                 case sf::keyboard::s:                     universe.getplayer()->setmovedown(false);                     break;                 }                 break;              }           }          distx = (sf::mouse::getposition().x - universe.getplayer()->getxpos() - window.getposition().x - 10);         disty = (sf::mouse::getposition().y - universe.getplayer()->getypos() - window.getposition().y - 30);         if (distx != 0){             angle = std::atan2f(disty, distx);             universe.getplayer()->setangle(angle + (b2_pi / 2));         }          //updating universe         universe.update();          //drawing         window.draw(universe.getplayer()->draw());          std::list<abstractblock>::iterator i;          (i = universe.getloadedblocks()->begin(); != universe.getloadedblocks()->end(); i++){             window.draw(i->draw());         }             window.display();       }      universe.savegame();      return 0; } 

so trying figure out problem on own, , thought may have been part use iterator , lists draw current blocks in universe. thought because both universe , main .cpp have these small loops in them (which added). commented out parts in each file , things got weirder. visual studio 2013 gave me errors when ran program , take me xutility file! have no idea why! made sure comment out iterator part , tried again same thing happened! 2 lines of iterators commented out i'm not using iterators @ in program! why taking me there? please i'm confused >.<

edit: abstractblock.cpp:

#include "abstractblock.h"   abstractblock::abstractblock() { }  abstractblock::abstractblock(int x, int y, float roation, b2world *world){  }  sf::sprite abstractblock::draw(){     sf::sprite sprite;     return sprite; }  void abstractblock::destroy(b2world *world){  }   abstractblock::~abstractblock() { } 

i'm java programmer, , wasn't sure if there way make "abstract" class can in java, instead made normal class not many defined methods, inherited other classes.

second edit: have decided show dirt class extends abstracblock class , far class inherits abstractblock:

#include "dirtblock.h"   dirtblock::dirtblock() { }  dirtblock::dirtblock(int x, int y, float rotation, b2world *world){     bodydef.position.set(x, y);     bodydef.type = b2_dynamicbody;      fixdef.density = .1f;      b2polygonshape shape;     shape.setasbox(16, 16);      fixdef.shape = &shape;      body = world->createbody(&bodydef);     body->createfixture(&fixdef);      texture.loadfromfile("dirt.png");  }  void dirtblock::destroy(b2world *world){     world->destroybody(body);     body = nullptr; }   dirtblock::~dirtblock() { }  sf::sprite dirtblock::draw(){     sf::sprite sprite;     sprite.settexture(texture);     sprite.setorigin(16, 16);     sprite.setposition(body->getposition().x, body->getposition().y);     return sprite; } 

third edit: also! visualstudio takes me when try run program:

 #if _iterator_debug_level == 2             if (_myproxy != _parent_proxy)                 {   // change parentage                 _lockit _lock(_lock_debug);                 _orphan_me();                 _mynextiter = _parent_proxy->_myfirstiter;                 _parent_proxy->_myfirstiter = this;                 _myproxy = _parent_proxy;                 } 

it's located in xutility class , have no idea is.the next line performed _mynextiter line.

well, immediate guess forgot add abstractblock.cpp project.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -