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

Author Topic: Unresolved Symbols  (Read 2502 times)

0 Members and 1 Guest are viewing this topic.

TestSubject06

  • Newbie
  • *
  • Posts: 8
    • View Profile
Unresolved Symbols
« on: April 27, 2012, 01:51:29 am »
Building and running the Threads example works fine, but when I move on to the Window example I get some very strange and obscure compiler errors.
Code: [Select]
#include <SFML/Window.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}
results in:
Code: [Select]
Error 6 error LNK1120: 5 unresolved externals C:\Users\Zack\Documents\My Dropbox\Private\VisualStudio\SFML_Test\Debug\SFML_Test.exe SFML_Test
Error 4 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:\Users\Zack\Documents\My Dropbox\Private\VisualStudio\SFML_Test\SFML_Test\SFML_Test.obj SFML_Test
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main C:\Users\Zack\Documents\My Dropbox\Private\VisualStudio\SFML_Test\SFML_Test\SFML_Test.obj SFML_Test
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main C:\Users\Zack\Documents\My Dropbox\Private\VisualStudio\SFML_Test\SFML_Test\SFML_Test.obj SFML_Test
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main C:\Users\Zack\Documents\My Dropbox\Private\VisualStudio\SFML_Test\SFML_Test\SFML_Test.obj SFML_Test

I'm using Windows 7 64 bit, with Visual Studio 2010. When I build SFML I seem to be missing some files:
Code: [Select]
sfml-audio.lib
sfml-audio-d.lib
sfml-graphics.lib
sfml-graphics-d.lib
sfml-network.lib
sfml-network-d.lib
sfml-system.lib
sfml-system-d.lib
So I just left the original ones in there (from the VC2008 build) and it seemed to work fine. At least the stuff in system example didn't mind.

Any ideas?

TestSubject06

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Unresolved Symbols
« Reply #1 on: April 27, 2012, 02:22:02 am »
okay wow, nevermind I was missing some lines in the Linker->Input->Additional Dependencies. The setup page only mentioned sfml-system.lib which would explain why the system example worked fine.

Now it compiles, but when I run it it does nothing. No window is created, no errors are thrown, nothing happens.
Code: [Select]
#include <SFML/Window.hpp>
#include <iostream>

int main()
{
    std::cout<<"stuff1";
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
std::cout<<"stuff2";

    // Start main loop
    bool Running = true;
    while (Running)
    {
        //App.Display();
std::cout<<"stuff";
    }
    std::cout<<"stuff3";
    return EXIT_SUCCESS;
}
never even outputs "stuff1"

Without the sf::Window App ... it does all of the cout stuff.

Edit: stuff in the System and Audio sections seem to work fine for me, but as soon as I try to even make a reference to the Window class it just hangs.

If it matters I have a Radeon HD 6870 gfx card.
« Last Edit: April 27, 2012, 02:46:45 am by TestSubject06 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Unresolved Symbols
« Reply #2 on: April 27, 2012, 08:01:53 am »
Search for "ATI bug" on this forum. You should find thousands of threads.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Unresolved Symbols
« Reply #3 on: April 27, 2012, 01:06:22 pm »
Search for "ATI bug" on this forum. You should find thousands of threads.

Which implies: Don't use SFML 1.6, because:
  • SFML 2 has already a release candidate!
  • SFML 1.6 hasn't been updated for longer time and many known bugs didn't get fixed anymore.
  • The ATI bug doesn't let you run SFML 1.6 applications unless you link statically
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TestSubject06

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Unresolved Symbols
« Reply #4 on: April 27, 2012, 03:01:46 pm »
Yeah, sorry... I switched over to 2.0 when a few of my friends told me about the ATI bug. Everything went smooth from there. Thanks for your help though.