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

Author Topic: Unresolved External Symbol  (Read 21116 times)

0 Members and 2 Guests are viewing this topic.

eca3101

  • Guest
Unresolved External Symbol
« on: March 20, 2014, 09:20:57 pm »
It's my first time posting here so forgive me for any errors

So I installed SFML today and tried to compile this code:

#include <SFML/Graphics.hpp>
int main()
{
   sf::RenderWindow Window(sf::VideoMode(800, 600), "My First SFML Game");
   while(Window.isOpen())
   {
      sf::Event Event;
      while(Window.pollEvent(Event))
      {
         if (Event.type == sf::Event::Closed)
            Window.close();
      }
   }
   return 0;
}

I ended up getting these errors:

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::close(void)" (__imp_?close@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: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@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

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main

1>C:\Users\User1\Desktop\programs\Windows\SFML\test\SFMLtestWorks\Debug\SFMLtestWorks.exe : fatal error LNK1120: 8 unresolved externals

Idk what I did wrong, anyone know what to do to fix this?
Thanks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Unresolved External Symbol
« Reply #1 on: March 20, 2014, 10:06:39 pm »
Hey! Welcome to the forum. You might want to read this thread. ;)

What compiler version are you using? Where did you get SFML from?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #2 on: March 20, 2014, 11:00:43 pm »
I'm using Visual C++ 2010 express edition, and I got SFML from here (http://www.sfml-dev.org/download/sfml/2.1/) I chose VC++ 2010 64 bit (because my pc 64 bit) and everything. I followed the step-by-step guide to installing it and I did everything correctly  (or at least I think I did  :o) and windows 7
« Last Edit: March 20, 2014, 11:07:03 pm by eca3101 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #3 on: March 20, 2014, 11:07:51 pm »
The 64 bits doesn't mean that it has to match your system's, but you need to have it match your compiler.
The VS 2010 Express edition doesn't ship with a x64 compiler (but it can get installed afterwards).

While there's no reason to use VS 2010 Express when there's VS 2013 Express around, you need to make sure the compiler architecture match.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #4 on: March 20, 2014, 11:14:58 pm »
So I just installed the 32 bit version, and for some reason I'm getting the same errors.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #5 on: March 20, 2014, 11:23:55 pm »
Did you make a clean rebuild?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #6 on: March 20, 2014, 11:28:50 pm »
Yeah, still got the error

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #7 on: March 20, 2014, 11:35:17 pm »
Well you need to provide more information.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #8 on: March 20, 2014, 11:47:14 pm »
Skipping... (no relevant changes detected)
1>  main.cpp
1>  Microsoft (R) Incremental Linker Version 10.00.30319.01
1>  Copyright (C) Microsoft Corporation.  All rights reserved.

That's what I got (with the same errors underneath)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #9 on: March 21, 2014, 12:20:31 am »
Please copy the stuff from the "Build" settings and make sure the options are actually set as to the thread I linked.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #10 on: March 21, 2014, 12:24:28 am »
Well here's the whole thing:

1>  Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  cl /c /ISFML_STATIC /ZI /nologo- /W3 /WX- /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
1>cl : Command line warning D9035: option 'nologo-' has been deprecated and will be removed in a future release
1> 
1>  Skipping... (no relevant changes detected)
1>  main.cpp
1>  Microsoft (R) Incremental Linker Version 10.00.30319.01
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  "/OUT:C:\Users\User1\Desktop\programs\Windows\SFML\test\SFMLtestWorks\Debug\SFMLtestWorks.exe" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/ManifestFile:Debug\SFMLtestWorks.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\User1\Desktop\programs\Windows\SFML\test\SFMLtestWorks\Debug\SFMLtestWorks.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\User1\Desktop\programs\Windows\SFML\test\SFMLtestWorks\Debug\SFMLtestWorks.lib" /MACHINE:X86 Debug\main.obj
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::close(void)" (__imp_?close@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: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@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
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main
1>C:\Users\User1\Desktop\programs\Windows\SFML\test\SFMLtestWorks\Debug\SFMLtestWorks.exe : fatal error LNK1120: 8 unresolved externals

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #11 on: March 21, 2014, 12:27:42 am »
Well you're not linking against any SFML libraries, might want to look at the tutorial again. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #12 on: March 21, 2014, 12:37:15 am »
Now it gives me this error:
LINK : fatal error LNK1104: cannot open file 'sfml-graphics.lib sfml-window.lib sfml-system.lib kernel32.lib'

eca3101

  • Guest
Re: Unresolved External Symbol
« Reply #13 on: March 21, 2014, 12:41:16 am »
Ok ends up I was missing a semicolon between those lib, but now when I run the program I get an error saying: 'The program can't start because sfml-graphics-2.dll is missing from your computer. Try reinstalling the program to fix this program.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved External Symbol
« Reply #14 on: March 21, 2014, 12:52:22 am »
Details matter:

Quote from: Tutorial
Now compile the project, and if you linked to the dynamic version of SFML, don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything