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

Author Topic: Lnk1120 Dynamic and static linking  (Read 4146 times)

0 Members and 1 Guest are viewing this topic.

TheCommunistDuck

  • Newbie
  • *
  • Posts: 11
    • View Profile
Lnk1120 Dynamic and static linking
« on: July 28, 2010, 02:02:40 pm »
Hey.

Had several link issues, mainly since I was linking sfml-main-d.lib not sfml-system-d.lib. :roll:
However, this program does not link:
Code: [Select]

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
    sf::Clock timer;
    // Start main loop
    bool Running = true;
    while (Running)
    {
        //App.Display();
    }

    return EXIT_SUCCESS;
}


And link errors:
Code: [Select]

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


I link to sfml-graphics-d.lib sfml-system-d.lib, and define SFML_DYNAMIC.
DLLs are in my obj folder, my bin folder, and my src folder.

I think it's not the DLLs, since removing them gets no change.

Thanks.

chipsman

  • Newbie
  • *
  • Posts: 23
    • View Profile
Lnk1120 Dynamic and static linking
« Reply #1 on: July 28, 2010, 03:01:18 pm »
I think you forgot to link with sfml-window-d.lib

Read the tutorial, all is explained in it.  :wink:

You have to link in this order:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib

Of course, the definition of SFML_DYNAMIC is correct.

TheCommunistDuck

  • Newbie
  • *
  • Posts: 11
    • View Profile
Lnk1120 Dynamic and static linking
« Reply #2 on: July 28, 2010, 05:17:15 pm »
Sorry, that's a post typo. I have linked to sfml-window-d.lib, just forgot to type that. Whoops.

I've linked to sfml-main-d.lib as well, and added -s for static, and it's fine. However I still can't dynamically link.