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

Author Topic: Just started, but can't start  (Read 2037 times)

0 Members and 1 Guest are viewing this topic.

OceanJeff40

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Just started, but can't start
« on: April 20, 2019, 06:48:32 am »
Hello, SFML!

So I downloaded SFML, and tried to compile and link everything blah blah blah, and I get linker errors, my question is:  How do I know what lib links I'm missing?  I've included all the .lib links, and it still gives LNK errors.

Any help would be appreciated, I'm working in Visual Studio 2017, and just downloaded the package from the website.

I remember trying out SFML years ago, and I was able to get all the demos working, but I decided not to use it.  Until now, when I'm going to take a serious look at it.

Thanks,

Jeff Cummings
Hobby Programmer looking to release something soon!  :D

OceanJeff40

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Just started, but can't start
« Reply #1 on: April 20, 2019, 07:48:47 am »
Exact error list is here:

1>------ Build started: Project: SFML1, Configuration: Release x64 ------
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::CircleShape::CircleShape(float,unsigned __int64)" (__imp_??0CircleShape@sf@@QEAA@M_K@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QEAA@VVideoMode@1@AEBVString@1@IAEBUContextSettings@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QEAA@EEEE@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::Window::display(void)" (__imp_?display@Window@sf@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QEAA_NAEAVEvent@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QEBA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::Window::close(void)" (__imp_?close@Window@sf@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)" (__imp_?draw@RenderTarget@sf@@QEAAXAEBVDrawable@2@AEBVRenderStates@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QEAAXAEBVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::Shape::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Shape@sf@@QEAAXAEBVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QEAA@PEBDAEBVlocale@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QEAA@III@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl sf::CircleShape::~CircleShape(void)" (__imp_??1CircleShape@sf@@UEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::String::~String(void)" (__imp_??1String@sf@@QEAA@XZ)
1>c:\Users\jcummings\source\repos\SFML1\x64\Release\SFML1.exe : fatal error LNK1120: 17 unresolved externals
1>Done building project "SFML1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

OceanJeff40

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Just started, but can't start
« Reply #2 on: April 20, 2019, 07:59:38 am »
Here are the additional dependencies that I have listed in the project:

sfml-window.lib
sfml-window-s.lib
sfml-system.lib
opengl32.lib
freetype.lib
winmm.lib
gdi32.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib
ws2_32.lib

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: Just started, but can't start
« Reply #3 on: April 20, 2019, 09:47:04 am »
A couple of things - you don't want sfml-window.lib AND sfml-window-s.lib The -s files are only used for static linking and you'll never need both versions in a project. Look at the function names in the error, for example sf::CircleShape. The docs will tell you which sfml module this is in (in this case sfml-graphics so you need to link that). Oh, and also remember to use the -d versions when linking the debug build :) HTH

OceanJeff40

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Just started, but can't start
« Reply #4 on: April 21, 2019, 05:47:31 am »
OMG, thanks for your reply!  I was just linking the dependencies, not the modules themselves!  I feel stupid.

I knew it had to be something like that..... dang.

Really appreciate it!  It compiles and runs!

 8) :o ;D :D ;) :) :P ::)

Jeff Cummings