SFML community forums

Help => General => Topic started by: acmd on July 06, 2013, 12:35:00 pm

Title: [SOLVED]Linking Error
Post by: acmd 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 (http://sfml-dev.org/tutorials/2.0/start-vc.php) 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.
Title: AW: Linking Error
Post by: eXpl0it3r 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?
Title: Re: Linking Error
Post by: acmd 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.
Title: Re: Linking Error
Post by: Laurent on July 06, 2013, 06:14:24 pm
You're using old SFML headers, this prototype of RenderWindow::RenderWindow no longer exists.
Title: Re: Linking Error
Post by: acmd 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