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

Author Topic: 15 unresolved externals  (Read 476 times)

0 Members and 2 Guests are viewing this topic.

GavinWilliams

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
15 unresolved externals
« on: May 04, 2025, 04:20:03 am »
I've followed the Visual Studio setup. Intellisense is picking up the libraries but I have 15 unresolved externals (link errors) in the error list.

Just to go over what I've done...

* Downloaded the 32 bit sfml package for windows
* Copied the sfml files to G:\Tools\SFML-3.0.0\
* Set C++ Language Standard = Cpp17
* Set C++ / General / Additional Include Directories = G:\Tools\SFML-3.0.0\include
* Set Linker / General / Additional Library Directories = G:\Tools\SFML-3.0.0\lib
* Set Linker / Input / Additional Dependencies (Debug) = sfml-system-d.lib;sfml-graphics-d.lib;sfml-audio-d.lib;sfml-network-d.lib;sfml-window-d.lib;%(AdditionalDependencies)
* Set Linker / Input / Additional Dependencies (Release) = sfml-system.lib;sfml-graphics.lib;sfml-audio.lib;sfml-network.lib;sfml-window.lib;%(AdditionalDependencies)
* Copied sfml-audio-3.dll, sfml-audio-d-3.dll, etc to <soln>/x64/Debug

I get the following errors...

unresolved external symbol "__declspec(dllimport) public: bool __cdecl sf::WindowBase::isOpen(void)const " (__imp_?isOpen@WindowBase@sf@@QEBA_NXZ) referenced in function main

unresolved external symbol "__declspec(dllimport) public: class std::optional<class sf::Event> __cdecl sf::WindowBase::pollEvent(void)" (__imp_?pollEvent@WindowBase@sf@@QEAA?AV?$optional@VEvent@sf@@@std@@XZ) referenced in function main

unresolved external symbol "__declspec(dllimport) public: static struct sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2U12@B) referenced in function main

unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl sf::Window::close(void)" (__imp_?close@Window@sf@@UEAAXXZ) referenced in function main

unresolved external symbol "__declspec(dllimport) public: virtual __cdecl sf::CircleShape::~CircleShape(void)" (__imp_??1CircleShape@sf@@UEAA@XZ) referenced in function main

etc

Just some extra info, if I change the build to target x86 I get squiggles under everything.

I've also tried the 64 bit sfml files to match up with the target architecture, but it's the same linker issue.

Regarding the tutorial page - it says nothing about the architecture, maybe the author assumes we should know if 32 bit applications can run on x64 - sound right to me. Another thing, at the end of the tutorial it says...

'don't forget to copy the SFML DLLs to same directory as your compiled executable' - why would we forget if we never even thought of it?! After all, didn't I just copy sfml to my dev drive and link to it. And at the start of the tutorial it says...

'You can then unpack the SFML archive wherever you like. Copying headers and libraries to your installation of Visual Studio is not recommended, it's better to keep libraries in their own separate location' - I guess they don't mean the dll's as well - though it doesn't say anything about that.

Release build works, but debug build doesn't.
« Last Edit: May 04, 2025, 05:26:21 am by GavinWilliams »

GavinWilliams

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: 15 unresolved externals
« Reply #1 on: May 04, 2025, 07:06:10 am »
I think I've fixed it. Not sure what was happening at first when I was using the 32 bit 'package'. But I ended up with a mixed configuration, once I updated the paths to the 64 bit sfml installation, I got it running in 64 bit mode. That's fine for me, as I'm introducing my 10 year old to C++ and I want to use sfml as a framework so that he doesn't have to build a Win32 application layer & rendering engine. I think that's all just too much for him right now, whereas with sfml he can transfer his skills with MS Makecode & C# console. And the architecture doesn't matter to much.