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

Author Topic: vs 2013 express build error Error 2 error LNK2001  (Read 2797 times)

0 Members and 1 Guest are viewing this topic.

wgan

  • Newbie
  • *
  • Posts: 10
    • View Profile
vs 2013 express build error Error 2 error LNK2001
« on: May 23, 2014, 02:48:49 pm »
windows 8 64bit, latest snapshot, followed every step in
http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php
and
http://www.sfml-dev.org/tutorials/2.0/start-vc.php
and it built just fine with static link (both release and debug), but when i do a little test using the hello code vs threw a bunch of errors like the format of this one:

Error 2 error LNK2001: unresolved external symbol __imp_glReadPixels E:\src\SFML\test\sfml-graphics-s.lib(RenderWindow.obj)

SFML_STATIC is set, any ideas what went wrong?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: vs 2013 express build error Error 2 error LNK2001
« Reply #2 on: May 23, 2014, 05:00:40 pm »
As zsbzsb pointed out, things have changed. If you look in the tutorials of version 2.0 (current stable version 2.1), you should not except it to work for the latest development version.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wgan

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: vs 2013 express build error Error 2 error LNK2001
« Reply #3 on: May 24, 2014, 03:57:38 pm »
which i suppose to add these lib in the additional link input in VS2013? it failed with same error, then i suppose these libs were made in 2012, so i need to build each external library (from source) in 2013 by myself?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: vs 2013 express build error Error 2 error LNK2001
« Reply #4 on: May 24, 2014, 11:00:52 pm »
You add the extlibs directory to the General->Additional Library Directories setting and add the libraries themselves Input->Additional Dependencies.

No, all these libraries are C libraries and as such have a clear defined ABI and don't need rebuilding between different compiler versions.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wgan

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: vs 2013 express build error Error 2 error LNK2001
« Reply #5 on: May 25, 2014, 02:10:04 pm »
still getting the same errors, should the adding ext lib part be done while building the SFML source or individual project stage?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: vs 2013 express build error Error 2 error LNK2001
« Reply #6 on: May 25, 2014, 06:18:46 pm »
When building SFML CMake does all the work.

If you link your project statically against SFML you need to specify the additional libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wgan

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: AW: vs 2013 express build error Error 2 error LNK2001
« Reply #7 on: May 26, 2014, 12:36:54 am »
When building SFML CMake does all the work.

If you link your project statically against SFML you need to specify the additional libraries.

thats where i was stuck, i don't think i missed a single step and setting, it still gives the same error, additional libraries were added, SFML_STATIC was set.

does this error mean that in the link stage the compiler simply can't find the proper libraries?


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: vs 2013 express build error Error 2 error LNK2001
« Reply #8 on: May 26, 2014, 08:07:31 am »
If it's still the same error as above, you're not linking against OpenGL (opengl32).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wgan

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: vs 2013 express build error Error 2 error LNK2001
« Reply #9 on: May 26, 2014, 01:29:54 pm »
cheers, the build went through without any error this time except the code doesn't run as expected, its supposed to show a cyan circle instead what i've got here is blank screen, but since now i got it linked i'll figure it out by myself, thank you for your help!

ps here the code maybe its for 1.2 i haven't got a chance to look into it

#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 480), "SFMLApplication");
        sf::CircleShape shape;
        shape.setRadius(40.f);
        shape.setPosition(100.f, 100.f);
        shape.setFillColor(sf::Color::Cyan);
       
        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();
        }
}