While converting some openGL tutorial code from glfw to SFML i've run across an error i can't seem to get rid of, when I attempt to set the mouse position it gives me an unresolved external symbol error. The exact error is:
1> All outputs are up-to-date.
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl sf::Mouse::setPosition(class sf::Vector2<int> const &,class sf::Window const &)" (__imp_?setPosition@Mouse@sf@@SAXABV?$Vector2@H@2@ABVWindow@2@@Z) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::RenderTarget::convertCoords(class sf::Vector2<int> const &)const " (__imp_?convertCoords@RenderTarget@sf@@QBE?AV?$Vector2@M@2@ABV?$Vector2@H@2@@Z) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<int> __thiscall sf::Window::getPosition(void)const " (__imp_?getPosition@Window@sf@@QBE?AV?$Vector2@H@2@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::asSeconds(void)const " (__imp_?asSeconds@Time@sf@@QBEMXZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Time __thiscall sf::Clock::getElapsedTime(void)const " (__imp_?getElapsedTime@Clock@sf@@QBE?AVTime@2@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Clock::Clock(void)" (__imp_??0Clock@sf@@QAE@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<unsigned int> __thiscall sf::Image::getSize(void)const " (__imp_?getSize@Image@sf@@QBE?AV?$Vector2@I@2@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned char const * __thiscall sf::Image::getPixelsPtr(void)const " (__imp_?getPixelsPtr@Image@sf@@QBEPBEXZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::~Image(void)" (__imp_??1Image@sf@@QAE@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Image::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?loadFromFile@Image@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::Image(void)" (__imp_??0Image@sf@@QAE@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setVerticalSyncEnabled(bool)" (__imp_?setVerticalSyncEnabled@Window@sf@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setMouseCursorVisible(bool)" (__imp_?setMouseCursorVisible@Window@sf@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
I would think this is because i'm not including the right files, but i have all of my include files correct. Here is the bit of code:
void computeMatricesFromInputs
(sf
::RenderWindow& window
, int
& key
){ //going to need a clock for time and a mouse of position coordiantes sf
::Clock clock; static double lastTime
= (double)(clock.
getElapsedTime()).
asSeconds(); // Compute time difference between current and last frame double currentTime
= (double)(clock.
getElapsedTime()).
asSeconds(); float deltaTime
= float(currentTime
- lastTime
); //get mouse position sf
::Vector2f mousePos
= window.
convertCoords(window.
getPosition()); // Reset mouse position for next frame //set position of mouse so it does not move at all sf
::Mouse::setPosition(sf
::Vector2i(512, 384), window
); // Compute new orientation horizontalAngle
+= mouseSpeed
* float(1024/2 - mousePos.
x ); verticalAngle
+= mouseSpeed
* float( 768/2 - mousePos.
y ); // Direction : Spherical coordinates to Cartesian coordinates conversion glm
::vec3 direction
( cos(verticalAngle
) * sin(horizontalAngle
), sin(verticalAngle
), cos(verticalAngle
) * cos(horizontalAngle
) );//goes on... it must be a silly problem of mine, thanks for any help!