我正在使用SFML,我一直在尝试使用顶点数组,但是每当我写类似的东西时
sf::Vertex vertex;
并编译,它给了我一个错误说
"Vertex"不是SF的成员
#include<iostream>
#include<SFML/Graphics.hpp>
#include<Vertex.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();
}
sf::Vertex vertex;
return 0;
}
它现在也给了我一个错误说:
"SFMLtest.cpp:3:9: fatal error: Vertex.hpp: No such file or directory
#include<Vertex.hpp>"
#include<Vertex.hpp>
上行应为:
#include <SFML/Graphics/Vertex.hpp>
但是你根本不需要它,因为#include <SFML/Graphics.hpp>
已经为你做了。因此,只需完全删除包含顶点线即可。