我使用這個基本的sdl程序來學習打印屏幕。C主要表達式 - 它是否是主要表達式?
我收到以下錯誤,當我運行應用程序:
error: expected primary expression before '=' token"
#include "SDL.h"
#include <stdio.h>
#define window
using namespace std;
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
int main(int argc, char* args[])
{
SDL_Surface* screenSurface =NULL;
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
printf("SDL could not initialize! SDL_Error: %s\n",SDL_GetError());
}
else
{
window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
}
if(window==NULL)
{
window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
}
}
什麼是'window'?你是否可以請嘗試創建一個[最小化,完整和可驗證示例](http://stackoverflow.com/help/mcve)並向我們展示? –
當然。這裏是 #include「SDL.h」 #include #define window using namespace std; const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc,char * args []) { SDL_Surface * screenSurface = NULL; (SDL_Init(SDL_INIT_VIDEO)<0) printf(「SDL無法初始化!SDL_Error:%s \ n」,SDL_GetError()); } 別的 { 窗口= SDL_CreateWindow( 「SDL教程」,SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_WINDOW_SHOWN); } if(window == NULL) –
raedon707
哦,請*編輯您的問題*以顯示代碼。 :) –