Visual Studio 2010 SDL_Event errors
Visual Studio 2010 SDL_Event errors
我正试图用Visual Studio 2010创建一个SDL游戏,但在构建项目时遇到了很多编译错误。我遵循了本教程来设置Visual Studio,并且我遵循了SDL的本教程。给我这些错误的两部分代码是我的CApp_OnEvent和CApp文件。
CApp_OnEvent:
#include "CApp.h"
void CApp::OnEvent(SDL_EVENT* Event) {
}
CApp:
#include "CApp.h"
CApp::CApp() {
Running = true;
}
int CApp::OnExecute() {
if(OnInit() == false) {
return -1;
}
SDL_EVENT Event;
while(Running) {
while(SDL_PollEvent(&Event)) {
OnEvent(&Event);
}
OnLoop();
OnRender();
}
OnCleanup();
return 0;
}
int main(int argc, char* argv[]) {
CApp theApp;
return theApp.OnExecute();
}
以下是我尝试构建Visual Studio时的输出:
1>------ Build started: Project: SDL Game, Configuration: Debug Win32 ------
1>Build started 11/24/2011 10:58:45 AM.
1>InitializeBuildStatus:
1> Touching "DebugSDL Game.unsuccessfulbuild".
1>ClCompile:
1> CApp_OnRender.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1> CApp_OnLoop.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1> CApp_OnInit.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1> CApp_OnEvent.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp_onevent.cpp(3): error C2065: 'SDL_EVENT' : undeclared identifier
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp_onevent.cpp(3): error C2065: 'Event' : undeclared identifier
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp_onevent.cpp(3): error C2448: 'CApp::OnEvent' : function-style initializer appears to be a function definition
1> CApp_OnCleanup.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1> CApp.cpp
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.h(18): error C2061: syntax error : identifier 'SDL_EVENT'
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(12): error C2065: 'SDL_EVENT' : undeclared identifier
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(12): error C2146: syntax error : missing ';' before identifier 'Event'
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(12): error C2065: 'Event' : undeclared identifier
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(15): error C2065: 'Event' : undeclared identifier
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(15): error C3861: 'SDL_PollEvent': identifier not found
1>c:usersnathandocumentsvisual studio 2010projectssdl gamesdl gamecapp.cpp(16): error C2065: 'Event' : undeclared identifier
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.24
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
您可以通过以下链接查看我项目的其余代码:http://www.mediafire.com/download.php?5524qr1zodracc5
你知道我为什么会犯这些错误吗?谢谢
好吧,我又回答了我自己的问题。我需要使用SDL_Event,而不是SDL_Event。
为这样一个愚蠢的错误羞愧地垂下头
相关文章:
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 在没有参数列表的情况下使用模板名称"Event"无效,模板问题
- cl::Event::waitForEvents returns -7 (CL_EXEC_STATUS_ERROR_ F
- QT QPushButton Press Event
- mmap with /dev/input/event*
- LNK2005 AND LNK1169 Errors - C++
- C++ errors - C4819, C2761, C2447
- 如何使用 epoll(void* event.data.ptr) 管理 Connection 的生命周期
- Visual Studio Build Errors not in UI
- STL reverse_iterator errors
- C++ Class Errors
- QGraphicsScene selectionChanged() event
- 为什么 event.mouseWheelScroll.delta 总是使用 SFML 返回 0
- gnustl (libstdc++) to llvm (libc++ ) errors
- HDF5 + Eclipse CDT errors
- osip library sip errors
- wxSmith Code::Blocks Hello World errors
- OpenCL C++绑定:等待单个 cl::Event
- 类型 "void (Biometria::*)(char *idSensor, GRCAP_FINGER_EVENTS event)" 的参数与类型 "GRCAP_STATUS_EVENT_PROC
- SDL errors Visual Studio 2013