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

Author Topic: [please read] Error with newly installed SFML  (Read 9632 times)

0 Members and 1 Guest are viewing this topic.

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
[please read] Error with newly installed SFML
« on: April 11, 2015, 09:38:06 pm »
I am using windows 7 and have visual studio 2013, and have just installed SFML 2.2. I did exactly what it said in the sfml tutorial (also watched some youtube vids) however when i type the code in the tutorial I get this:

1>------ Build started: Project: sfml, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\users\computer\documents\visual studio 2013\projects\sfml\main.cpp(1): fatal error C1083: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

Any ideas why this isn't working will be appreciated a lot. This is starting to drive me crazy now  :-[ Thanks in advance.

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #1 on: April 12, 2015, 11:55:51 am »
Could you post your code please. I know you said you did exactly as in the tutorial but it is possible that there is some error that isn't in linking as it is very easy to overlook them sometimes. Also, are you linking statically or dynamically?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10822
    • View Profile
    • development blog
    • Email
Re: [please read] Error with newly installed SFML
« Reply #2 on: April 12, 2015, 12:25:30 pm »
The error tells you all that you need to know. VS can't find SFML/Graphics.hpp.
The common reason for that would be that you didn't set the include directory. So even though you claim to have done everything exactly like the tutorial, did you tell VS where to find the headers of SFML?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #3 on: April 12, 2015, 01:51:19 pm »
The error tells you all that you need to know. VS can't find SFML/Graphics.hpp.
The common reason for that would be that you didn't set the include directory. So even though you claim to have done everything exactly like the tutorial, did you tell VS where to find the headers of SFML?

How might I do that please?

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #4 on: April 12, 2015, 01:54:29 pm »
Could you post your code please. I know you said you did exactly as in the tutorial but it is possible that there is some error that isn't in linking as it is very easy to overlook them sometimes. Also, are you linking statically or dynamically?

Here's my code. And I am pretty sure I am linking dynamically.
#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        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;
}
 

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: [please read] Error with newly installed SFML
« Reply #5 on: April 12, 2015, 02:20:26 pm »
How might I do that please?
Setting the include path is explained in the tutorial. Please read it carefully.

By the way, it doesn't matter how you link, because if the header is not found, you won't even get to the linking stage.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #6 on: April 12, 2015, 02:37:40 pm »
Umm, okay decided to re install SFML, and I get a new error now. Any ideas what it means? cheers

1>------ Build started: Project: SFML_T, 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>c:\users\computer\documents\visual studio 2013\Projects\SFML_T\Debug\SFML_T.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: [please read] Error with newly installed SFML
« Reply #7 on: April 12, 2015, 02:42:24 pm »
Yes, it's a linker error.

Again, read the SFML tutorial carefully -- every little step is explained exactly. Make sure you don't miss any of them.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #8 on: April 12, 2015, 04:27:25 pm »
I think the linker problem is with the static dependencies, however I have put in the '-s', all the dependencies, but am still getting the errors. Perhaps I have missed  something?  :-\

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: [please read] Error with newly installed SFML
« Reply #9 on: April 12, 2015, 07:59:04 pm »
Did you define SFML_STATIC?

Also, when Nexus says "read the SFML tutorial carefully", he literally means that. Read each sentence. No skipping.

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #10 on: April 12, 2015, 08:20:02 pm »
Did you define SFML_STATIC?

Also, when Nexus says "read the SFML tutorial carefully", he literally means that. Read each sentence. No skipping.

I did. And I read every line.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: [please read] Error with newly installed SFML
« Reply #11 on: April 12, 2015, 10:46:11 pm »
I think the prefix is '-d' not '-s'
for example: sfml-graphics-d.lib
Maybe you forgot setting .lib on the end of Linker.
Or maybe you don't setted DLLs next to .exe file(if using SFML\Graphics.hpp, set sfml-graphics-2.dll, or whats the name!!!)
IF IT DOESNT WORK READ CAREFULLY TUTORIAL!!!!

Dude, seriously shutup. I have only ever told one other person to shutup and that would be another infamous poster on these forums. You aren't helping and only are saying things which you yourself don't even understand. Everything you said doesn't apply and is incorrect. The prefix can be '-s-d' depending on the settings and dlls/file extensions don't even make sense in the context of this thread.

I know you think you are helping, but you are not and it would be best if you would stop posting until you learn about what you are trying to help with.

http://en.wikipedia.org/wiki/The_blind_leading_the_blind
« Last Edit: April 12, 2015, 10:48:08 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: [please read] Error with newly installed SFML
« Reply #12 on: April 12, 2015, 10:47:57 pm »
I think the prefix is '-d' not '-s'
Seriously, you have to stop telling wrong things. As much as you'd like to help people, this is not helpful at all. It causes confusion and makes threads unnecessarily long.

The postfix for static libraries is -s, not -d.
-d is for debug libraries.


Please, MasterDeveloper: if you have nothing to say or are not sure about your advice, then don't post. Repeating what has been said before ("read tutorial carefully") does not help either...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

MasterDeveloper

  • Newbie
  • *
  • Posts: 14
  • Forever, is not forever!
    • View Profile
    • Email
Re: [please read] Error with newly installed SFML
« Reply #13 on: April 12, 2015, 11:01:31 pm »
sorry but my libraries are renamed!
Born to be C++ Programmer!

oOhttpOo

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: [please read] Error with newly installed SFML
« Reply #14 on: April 14, 2015, 05:07:13 pm »
Thanks for all the answers, unfortunately no luck yet  :-\ I forgot to mention, is the problem happening because I am using visual studio express? I have since the post learnt express makes it quite hard/particular to build an app with a GUI, if using express.

 

anything