简体   繁体   English

c3867'sf::Time::as seconds':非标准语法;使用'&'创建指向成员的指针

[英]c3867'sf::Time::as seconds':non-standard syntax ;use '&'to create a pointer to a member

#include<SFML/Graphics.hpp>
#include<iostream>

int main() { int main() {

sf::RenderWindow Window;
Window.create(sf::VideoMode(800, 600), "Game Engine");
sf::Time time = sf::seconds(2);
std::cout << time.asSeconds << std::endl;
while (Window.isOpen()) {
    sf::Event Event;
    while (Window.pollEvent(Event))     {
        if (Event.type ==  sf::Event::Closed) {
            Window.close();
        }

        Window.display();

    }


    {

    }
}

} }

1>------ Build started: Project: SFML-2.0, Configuration: Debug Win32 ------ 1> Main.cpp 1>c:\\users\\paribeshpc\\documents\\visual studio 2015\\projects\\sfml-2.0\\sfml-2.0\\main.cpp(11): error C3867: 'sf::Time::asSeconds': non-standard syntax; 1>------ 构建开始:项目:SFML-2.0,配置:Debug Win32 ------ 1> Main.cpp 1>c:\\users\\paribeshpc\\documents\\visual studio 2015\\projects\\sfml -2.0\\sfml-2.0\\main.cpp(11): 错误 C3867: 'sf::Time::asSeconds': 非标准语法; use '&' to create a pointer to member ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========使用“&”创建指向成员的指针 ========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========

Please help me, I keep getting this error.请帮助我,我不断收到此错误。 I was learning sfml from this dued and I copied this code from him but its not working.我正在从这个到期中学习 sfml,我从他那里复制了这段代码,但它不起作用。 The link to the video 视频链接

sf::Time::asSeconds is a function , you need to call it: sf::Time::asSeconds是一个函数,你需要调用它:

std::cout << time.asSeconds() << std::endl;
//                         ^^
//      Note parentheses here

What happens right now is that the compiler thinks you want a pointer to the function, which is why it tells you to use the address-of operator & .现在发生的事情是编译器认为你想要一个指向函数的指针,这就是为什么它告诉你使用地址运算符&

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C3867:&#39;_com_error :: Description&#39;:非标准语法 使用“&”创建指向成员的指针 - C3867 : '_com_error::Description': non-standard syntax; use '&' to create a pointer to member Visual Studio 2015 错误 C3867 &#39;Rectangle::get_area&#39;:非标准语法; 使用“&amp;”创建指向成员的指针 - Visual Studio 2015 Error C3867 'Rectangle::get_area': non-standard syntax; use '&' to create a pointer to member “错误C3867:非标准语法; 使用虚拟流操纵器时,使用“&”创建指向成员的指针” - “Error C3867: non-standard syntax; use '&' to create a pointer to member” when using virtual stream manipulator std::unordered_map 中的 std::function,错误 C3867 非标准语法; 使用 '&amp;' 创建指向成员的指针 - std::function in std::unordered_map, error C3867 non-standard syntax; use '&' to create a pointer to member 非标准语法; 使用 '&amp;' 创建指向成员 C++ 的指针 - non-standard syntax; use '&' to create a pointer to member C++ 获取错误:C3867 &#39;Template_class<int> ::add&#39;: 非标准语法; 使用带有模板的函数指针时 - Getting error : C3867 'Template_class<int>::add': non-standard syntax; when using pointers to functions with templates 错误信息:非标准语法; 使用“&amp;”创建指向成员的指针 - Error Message: non-standard syntax; use '&' to create a pointer to member 非标准语法; 使用“&”创建指向成员的指针 - non-standard syntax; use '&' to create a pointer to member 非标准语法,使用 &amp; 创建指向成员的指针 - Non-standard syntax, use & to create a pointer to member c ++非标准语法; 使用“&”创建具有虚拟功能的成员的指针 - c++ non-standard syntax; use '&' to create a pointer to member with virtual function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM