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

Author Topic: Help: Including SFML lib into Visual C++ 2013 Professional  (Read 3572 times)

0 Members and 1 Guest are viewing this topic.

EvilCanadian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Help: Including SFML lib into Visual C++ 2013 Professional
« on: April 17, 2014, 05:12:13 am »
I've went through the 1st tutorial on how to include the SFML libs into VS, however when I try their test program from the 1st tutorial I'm coming across errors.

" error C2678: binary '<' : no operator found which takes a left-hand operand of type 'sf::Time' (or there is no acceptable conversion) "

or from the tooltip on the hover-over it states that " Error: no operator "<<" matches these operands. operand types are std::ostream << sf::Time"

Also I had to change the
Code: [Select]
while (Clock.GetElapsedTime () < 5.f) to
Code: [Select]
while (Clock.getElapsedTime () < 5.f) lower case g. same case with
Code: [Select]
sf::Sleep (0.5f); to
Code: [Select]
sf::sleep (0.5f);
Below is the copy paste of the compiler messages:

1>------ Build started: Project: SFMLTutorials, Configuration: Debug Win32 ------
1>  Tutorial1.cpp
1>f:\c++ projects\sfml tutorials\sfmltutorials\sfmltutorials\tutorial1.cpp(7): error C2678: binary '<' : no operator found which takes a left-hand operand of type 'sf::Time' (or there is no acceptable conversion)
1>          f:\microsoft visual studio 12.0\vc\include\sfml\system\time.hpp(185): could be 'bool sf::operator <(sf::Time,sf::Time)' [found using argument-dependent lookup]
1>          f:\microsoft visual studio 12.0\vc\include\sfml\system\string.hpp(398): or       'bool sf::operator <(const sf::String &,const sf::String &)' [found using argument-dependent lookup]
1>          while trying to match the argument list '(sf::Time, float)'
1>f:\c++ projects\sfml tutorials\sfmltutorials\sfmltutorials\tutorial1.cpp(7): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


EDIT: changed to use the
Code: [Select]
[code] thanks didii.
Help? Thanks in advance.
« Last Edit: April 19, 2014, 05:31:52 am by EvilCanadian »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10989
    • View Profile
    • development blog
    • Email
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #1 on: April 17, 2014, 07:21:10 am »
If you use SFML 2.x you should also read the corresponding tutorials and not the ones from SFML 1.6. ;)

SFML 2.x utilizes camelCase as opposed to CamelCase from SFML 1.6. Also there's an sf::Time class which can't directly be compared to floats or ints.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

didii

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #2 on: April 17, 2014, 04:17:20 pm »
Also, please use code tags for readability :)
Code: [Select]
[code] or [code=cpp]

EvilCanadian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #3 on: April 19, 2014, 05:29:21 am »
Thanks for the help, I followed a link to the 1.6 tutorials from a separate website. I should have looked around a bit. I think I've solved the issue, however now I'm experiencing a new one. Two error LNK2001 errors. Here is the copy/paste of the messages. I went though all the steps 3 times so I think I'm doing something incorrectly. I downloaded the x32 download.

Thanks for the additional help.

1>------ Rebuild All started: Project: TutorialOne, Configuration: Debug Win32 ------
1>  main.cpp
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Green" (?Green@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>F:\C++ Projects\SFML tutorials\Tutorial1\Debug\TutorialOne.exe : fatal error LNK1120: 2 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

EvilCanadian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #4 on: April 19, 2014, 05:44:23 am »
After reading this thread mine now compiles with no errors or warnings.

http://en.sfml-dev.org/forums/index.php?topic=9158.0

didii

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #5 on: April 19, 2014, 07:47:57 pm »
I followed a link to the 1.6 tutorials from a separate website.
Why are you using SFML 1.6 and not 2.0/2.1? The official tutorials for all of them are located here.

EvilCanadian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #6 on: April 20, 2014, 12:45:40 am »
I am now using the 2.1 version with only one issue... I was reading a post from cplusplus.com which recommended sfml and provided a link to the 1.6 tutorials, I have now undid everything I did following the 1.6 tutorials and am following the 2.1 tutorials and it is working.

My only issue is when I run in debug mode i'm missing MSVCR110D.dll, however when I run in release mode it works fine. I've went through some Microsoft forums however when I followed their steps it didnt work for me. I've more research to do there to make my program work in debug mode, however for now I'm operating in release mode with sfml with no issues.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10989
    • View Profile
    • development blog
    • Email
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #7 on: April 20, 2014, 01:00:28 am »
My only issue is when I run in debug mode i'm missing MSVCR110D.dll, however when I run in release mode it works fine. I've went through some Microsoft forums however when I followed their steps it didnt work for me. I've more research to do there to make my program work in debug mode, however for now I'm operating in release mode with sfml with no issues.
If that's missing on your development system, then your compiler installation is kind of broken.
If it's on another machine, just install the vs redistributable.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #8 on: April 20, 2014, 01:55:50 am »
Quote
MSVCR110D.dll

This dll is from VS 2012, so if your program compiled with SFML libs are complaining about it missing obviously you are using libs compiled for VS 2012 and since SFML doesn't provide compiled libs for 2013 you need to either - 1) compile SFML yourself OR 2) download a nightly build.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

EvilCanadian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help: Including SFML lib into Visual C++ 2013 Professional
« Reply #9 on: April 21, 2014, 11:19:44 pm »
I ran the repair option for my VS2013 and it fixed my problem.
Thanks guys.

 

anything