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

Author Topic: Error LNK2019 - trying to run sprites src. code!  (Read 2988 times)

0 Members and 1 Guest are viewing this topic.

Bonafide

  • Newbie
  • *
  • Posts: 18
    • View Profile
Error LNK2019 - trying to run sprites src. code!
« on: February 07, 2009, 07:52:19 am »
Hello guys!

I just found out about SFML a few days ago and decided to go with it over SDL, my original choice, to use for my group project for my HS C++ programming class (stronger, faster, probably more beneficial in the long run). We're making a simple 2D side scrolling platform game, so I was taking a gander at the "Displaying a sprite" tutorial, downloaded the source file, and attempted to run it but I got quite a few linker errors.

I'm pretty sure I've installed SFML correctly, and I did change the project's properties to include the graphics and system .libs, so I'm not sure what's up. I hope you guys can help me out! All help is appreciated.

Here's the error:

Code: [Select]

------ Build started: Project: Testing, Configuration: Debug Win32 ------
Compiling...
Sprites.cpp
Linking...
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Input::IsKeyDown(enum sf::Key::Code)const " (__imp_?IsKeyDown@Input@sf@@QBE_NW4Code@Key@2@@Z) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Input const & __thiscall sf::Window::GetInput(void)const " (__imp_?GetInput@Window@sf@@QBEABVInput@2@XZ) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Window::GetFrameTime(void)const " (__imp_?GetFrameTime@Window@sf@@QBEMXZ) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Close(void)" (__imp_?Close@Window@sf@@QAEXXZ) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (__imp_?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
Sprites.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::IsOpened(void)const " (__imp_?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
Sprites.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
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Testing\Debug\Testing.exe : fatal error LNK1120: 8 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Testing\Testing\Debug\BuildLog.htm"
Testing - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Error LNK2019 - trying to run sprites src. code!
« Reply #1 on: February 07, 2009, 09:01:36 am »
You forgot sfml-window.lib ;)
Laurent Gomila - SFML developer

Bonafide

  • Newbie
  • *
  • Posts: 18
    • View Profile
Error LNK2019 - trying to run sprites src. code!
« Reply #2 on: February 07, 2009, 08:20:47 pm »
Thanks Laurent, that solved the linker errors.

However, when I run the code, the window shell (when I mean shell, I mean the basic outline of a window, no screen) does popup, however, the console screen (cmd.exe) displays a lot of garbled text, and then VS2008 opens the "Just-In-Time" debugger.

What would cause this problem?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Error LNK2019 - trying to run sprites src. code!
« Reply #3 on: February 07, 2009, 08:56:06 pm »
You're compiling in Debug mode but linking to the Release libraries.
Laurent Gomila - SFML developer

Bonafide

  • Newbie
  • *
  • Posts: 18
    • View Profile
Error LNK2019 - trying to run sprites src. code!
« Reply #4 on: February 07, 2009, 10:42:49 pm »
That helped tremendously, now I know what those -d.dlls are for ;)

By the way, which image formats does SFML support?

Phoenix

  • Newbie
  • *
  • Posts: 27
    • View Profile
Error LNK2019 - trying to run sprites src. code!
« Reply #5 on: February 08, 2009, 10:45:04 am »
SFML "can load and save standard image formats : bmp, dds, jpg, png, tga, psd". http://www.sfml-dev.org/features.php