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

Author Topic: [SOLVED]Linking Error  (Read 1905 times)

0 Members and 1 Guest are viewing this topic.

acmd

  • Newbie
  • *
  • Posts: 4
    • View Profile
[SOLVED]Linking Error
« on: July 06, 2013, 12:35:00 pm »
Hi, I've been using SFML for quite a long time and didn't have any linker-related errors. Today I downloaded SFML 2.0 for vs2012 x64, set up project(include and lib folders, input libs for linker, x64 platform setting etc.) and tried to compile this tutorial code example, but I get following error:

Error   1       error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QEAA@VVideoMode@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEBUContextSettings@1@@Z) referenced in function main      E:\dev\Projects\arcadium\arcadium\EntryPoint.obj

But if I change constructor for sf::RenderWindow window to default like this:
#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window;
        window.setActive(true);
        window.setVisible(true);
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}
 
This code compiles without errors but evidently doesn't create any window. Am I missing something here?
Any help will be appreciated.
« Last Edit: July 06, 2013, 06:32:56 pm by acmd »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Linking Error
« Reply #1 on: July 06, 2013, 04:34:26 pm »
Are you linking the debugs libraries (-d suffix) in debug mode and the release (no suffix) in release mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

acmd

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking Error
« Reply #2 on: July 06, 2013, 05:09:38 pm »
Yes! Also there are many linkage errors(not just one) if I don't link any libraries at all, so it seems like I'm linking them correctly.
« Last Edit: July 06, 2013, 05:11:23 pm by acmd »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error
« Reply #3 on: July 06, 2013, 06:14:24 pm »
You're using old SFML headers, this prototype of RenderWindow::RenderWindow no longer exists.
Laurent Gomila - SFML developer

acmd

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking Error
« Reply #4 on: July 06, 2013, 06:31:31 pm »
Thank you, Laurent! I've completely forgotten that I have copied SFML/include into Visual Studio/include folder. Problem solved ;D