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

Author Topic: How to use predefined colours in SFML 1.6 on VS2010 Express  (Read 1116 times)

0 Members and 1 Guest are viewing this topic.

FluidHammer

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to use predefined colours in SFML 1.6 on VS2010 Express
« on: October 16, 2012, 03:24:08 pm »
Newbie to C++, so this is obvious...
Pasted the simple shapes example into a project that is already configured for SFML 1.6.
The lines containing the predefined colours, such as

        App.Draw(sf::Shape::Rectangle(350, 200, 600, 350, sf::Color::Green));

Produced the compiler message

Pang.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Green" (?Green@Color@sf@@2V12@B)

but when I tried 
       
App.Draw(sf::Shape::Rectangle(350, 200, 600, 350, sf::Color(0,255,0)));

a green rectangle appears.

How do I use the predefined colours, and how do I define my own?

 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: How to use predefined colours in SFML 1.6 on VS2010 Express
« Reply #1 on: October 16, 2012, 03:28:41 pm »
I strongly advise you against the usage of SFML 1.6, it has many bugs and lacks even more features that SFML 2 already provides... ;)

You use predefined colors the way you tried to use it, but the error is a linker issue. You either have mixed debug and release modes or you're mixing static and dynamic linkage.
Follow precisely the tutorials to avoid such things.

There's no SFML related functionalities for your own predefined colors, but you can easily create your own constants for colors... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FluidHammer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to use predefined colours in SFML 1.6 on VS2010 Express
« Reply #2 on: October 16, 2012, 03:49:44 pm »
Thanks for the prompt reply. I will stop messing about with 1.6 and make the leap to 2.0!

 

anything