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

Author Topic: namespace "sf" has no member "Vector2f"  (Read 2984 times)

0 Members and 1 Guest are viewing this topic.

MODOKI

  • Newbie
  • *
  • Posts: 1
    • View Profile
namespace "sf" has no member "Vector2f"
« on: October 05, 2023, 10:00:44 pm »
The vector2f gives me error "namespace 'sf' nas no member 'Vector2f'" but that line is copy/paste from the header Vertex.hpp comments. i dont know why vector2 is an error on visual code

#include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<SFML/System/Vector2.hpp>

/...

window.clear(sf::Color::Black);
        //draw everything here, create empty watever line
        sf::Vertex pieceofshitline[] = {
        //define points
        sf::Vertex(sf::[u]Vector2f[/u](  0,   0), sf::Color::Red, sf::Vector2f( 0,  0)),
« Last Edit: October 06, 2023, 08:11:10 am by eXpl0it3r »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: namespace "sf" has no member "Vector2f"
« Reply #1 on: October 07, 2023, 05:17:08 pm »
I presume that the [u] and [/u] are due to it being displayed as code and not actually in your code...

This sort of error seems to most often come about when linking incorrectly. It's hard to say without seeing an actual minimal and complete example and all of your linking setup.

Check:
  • you have added the SFML include folder to your inclusion list,
  • you have linked the SFML lib folder,
  • you have added the names of all libraries* to the linker,
  • the build SFML library is built with an identical compiler (including building it yoursel),
  • that you definitely aren't mixing up 32-bit and 64-bit builds.

I expect the code you have provided to work if it's linked properly and nothing else is weird in the rest of the code.

*all libraries here is the SFML modules you wish to use and all of the SFML dependencies. e.g. Graphics uses Window and System so you'd need to link all three to use the Graphics module.
If you are building statically, the dependencies includes all of the non-SFML components as well.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything