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

Author Topic: (Solved) Linker error: sf::Color  (Read 3527 times)

0 Members and 2 Guests are viewing this topic.

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
(Solved) Linker error: sf::Color
« on: October 03, 2020, 11:59:22 am »
Hi

I installed SFML 2.5.1 in VS2017, and i have a problem. I wrote a test code:

(click to show/hide)

And I got such errors: LNK2001 about sf::Color::Yellow and sf::RenderState::Default.

I imported all the libraries from the SFML-2.5.1\lib folder. I'm doing something wrong? Or this code (I copied it from internet  ;) ) is for older SFML version? I have no idea...

(Sorry for all English language errors, I'm not good at it)
« Last Edit: October 05, 2020, 04:45:10 pm by kamik1979 »

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Linker error: sf::Color
« Reply #1 on: October 03, 2020, 02:38:47 pm »
the code has no compile errors, altough you are creating a new circle every frame. just move this
sf::CircleShape ksztalt(std::sin(stoper.getElapsedTime().asSeconds()) * okno.getSize().y / 8 + okno.getSize().y / 4);
      ksztalt.setOrigin(sf::Vector2f(ksztalt.getRadius(), ksztalt.getRadius()));
      ksztalt.setPosition(okno.getSize().x / 2.0f, okno.getSize().y / 2.0f);
      ksztalt.setFillColor(sf::Color::Yellow);
to before this:
while (okno.isOpen())
 

so you won't create a new circle every loop.


but thats probably not what is causing your error. your description does not help much yet. what SO are you using, what version of SFML did you download, and what IDE do you use?
Visit my game site (and hopefully help funding it? )
Website | IndieDB

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Linker error: sf::Color
« Reply #2 on: October 03, 2020, 03:27:52 pm »
I'm using Visual Studio Community 2017 in Windows 10 x64 and I downloaded SFML 2.5.1 64 Bit. I'm compiling program with x64 architecture. In Project properties -> Linker -> Input -> Additional dependiences in x64 and Debug I have these entries:

(click to show/hide)

They are all libs that I have in SFML-2.5.1\lib

And in C/C++ -> General -> Additional include directories I have my SFML include folder path. (Similarly for Linker -> General -> Additional library directories I have my SFML lib folder path)

All DLLs are in the project folder.

I can't paste error messages that exactly I have becouse they are in polish language. They are LNK2001 errors. I tested network module and it's not working properly too.

I want to use SFML becouse I want to use network i my C++ program. I know that SFML it's easy way to do that. If you know any easy way to communicate between two computers using internet, I'll be happy if you want to share it with me.

I'm using this tutorial:
« Last Edit: October 03, 2020, 03:40:21 pm by kamik1979 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linker error: sf::Color
« Reply #3 on: October 03, 2020, 04:13:59 pm »
You probably defined SFML_STATIC but are trying to link SFML dynamically.
Don't define SFML_STATIC if you link SFML dynamically.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Linker error: sf::Color
« Reply #4 on: October 03, 2020, 05:07:31 pm »
Oh, yes, I removed SFML_STATIC and some errors vanishes  :P. But still error (another, E0265 and C2248) occurs when I try use TcpSocket::close(). VS 2017 says that it's inaccessible. What do you think about it?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linker error: sf::Color
« Reply #5 on: October 03, 2020, 05:47:58 pm »
I don't see that in your posted code, so no idea, maybe you're just doing something wrong.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Linker error: sf::Color
« Reply #6 on: October 03, 2020, 05:58:13 pm »
Here is errored code:

(click to show/hide)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linker error: sf::Color
« Reply #7 on: October 03, 2020, 06:02:45 pm »
Why are you trying to call close on a socket, after you've returned from the function?

And what's the error exactly?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Linker error: sf::Color
« Reply #8 on: October 03, 2020, 06:24:15 pm »
No i don't want to close socket after return  ;D. I wanted to show that function only. I can't paste whole error becouse it is in Polish language. Error codes I wrote above, it is E0265 and C2248.

kamik1979

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Linker error: sf::Color
« Reply #9 on: October 05, 2020, 04:44:23 pm »
I have read documentation carefully and i found that TcpSocket::close() is protected. I can close socket using TcpSocket::disconnect(). Thanks for all your help.

 

anything