我已经试过SDL 2了,正在收到一个SDL_Rect does not name a type错误.守则:
#include <stdio.h>
#include <SDL.h>
using namespace std;
SDL_Window* gWindow = NULL;
SDL_Surface* gWSurface = NULL;
SDL_Surface* gFinalImage = NULL;
int screenW = 640;
int screenH = 480;
SDL_Rect stretchRect;
stretchRect.x = stretchRect.y = 0;
stretchRect.w = screenW;
stretchRect.h = screenH;错误日志:
||=== Build: Debug in SDLEvents (compiler: GNU GCC Compiler) ===|
D:\My Works\SDL Stretching\TestingSDL.cpp|12|error: 'stretchRect' does not name a type|
D:\My Works\SDL Stretching\TestingSDL.cpp|13|error: 'stretchRect' does not name a type|
D:\My Works\SDL Stretching\TestingSDL.cpp|14|error: 'stretchRect' does not name a type|我已经在网上查过了另外一个问题,但到目前为止还没能解决这个问题.谢谢各位
发布于 2014-07-28 08:11:14
如果我正确地理解了您显示的代码,您将尝试在任何函数之外的全局范围内对矩形进行初始化。这样做是不可能的,你不能在函数之外有赋值语句。
有两种解决办法:
https://stackoverflow.com/questions/24990793
复制相似问题