将我的窗口设置为C 类
Set my window in a class c++
我不知道为什么,但是在课堂中创建窗口时会遇到错误。
错误是:
game.cpp(11): error C2064: term does not evaluate to a function taking 2 arguments
我不了解其原因,负责的班级是班级的构造函数:
window.cpp
Application::Application(std::map<string,string>& s, std::map<string, string>& t){
settings = s;
theme = t;
window(sf::VideoMode(800, 600), "Test"); //error is here
}
我的标题window.h
在私有设置为:
private:
std::map<string, string> settings;
std::map<string, string> theme;
sf::RenderWindow window;
我的main.cpp
像这样设置了它:
Application game(setting,style);
这可能是什么原因?
使用成员初始化器来初始化您的成员:
Application::Application(std::map<string,string>& s, std::map<string, string>& t)
:settings(s),
theme(t),
window(sf::VideoMode(800, 600), "Test")
{
}
它称为成员初始化器列表。成员初始化器列表组成在逗号分隔的初始化列表之前,先于结肠。它放置在关闭之后参数列表的括号和函数主体的开头括号之前。
相关文章:
- 为什么我的节点在我设置后被设置为 nullptr = 新节点?
- 如何使用C++为我的容器 Deque 设置最大大小?
- 设置我的应用程序 API 感知并防止系统使其模糊和错误定位
- 如何为我的游戏设置主菜单场景?QT C++
- 为什么我的突变器函数没有设置任何内容?还是我的构造函数?
- 我如何处理有关输入的字符串大小超过字符数组设置大小的错误?
- 我想在我设置的几秒钟后重新启动我的程序
- 为什么我的变量在我尚未将其设置为任何值时返回一个值?
- 我的控制台处理程序不处理 CTRL+C,即使设置正确
- 在我的 nucleo-L432KC 上设置时钟,使用 DMA 进行 5 通道 ADC 转换
- 如何设置我的dll加载,该dll取决于Env-ailiable的某些第三部分DLL
- 设置 Xcode 标志以便将 python 嵌入我的C++项目中
- 浏览器将随机HTTP消息正文发送到我的boost.asio服务器.我可以更改此设置吗?
- 如何在FFT之后设置我的数组的频带
- 分析我的输出文件时,如何设置IDA加载源文件
- 如何在 Visual Studio 中正确设置我的后期生成脚本
- 如何使用Qt3.3.0为windows应用程序开发环境设置我的计算机
- 设置我的源代码,构建目录和制作工具
- 我应该把这个.h文件放在哪里,或者如何在TextMate中正确设置我的路径
- 在 Tensorflow 的 C++ API 中,如何使用特征张量来设置我的 Tensorflow Tensor?