I have been trying to debug this error for the past few hours with no avail.
When using the following batch file to build my program,
REM Build process for text editor
@echo off
pushd build
cl /Zi /MDd /IC:UsersGiovannidev_libSDL2-2.0.4include /I"C:Program Files (x86)Microsoft Visual Studio 12.0VCinclude" /I"C:Program Files (x86)Windows Kits8.1Includeshared" ..*.c /link /NODEFAULTLIB:msvcrt.lib /ENTRY:mainCRTStartup /SUBSYSTEM:console /LIBPATH:C:UsersGiovannidev_libSDL2-2.0.4libx64 /LIBPATH:C:UsersGiovannidev_libSDL2_image-2.0.1libx64 SDL2.lib SDL2main.lib SDL2_image.lib /out:text_editor.exe
popd
I get the following error message in CMD:
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
..main.c(36) : error C2143: syntax error : missing ')' before 'type'
My entire class is here:
#include <assert.h>
#include <stdio.h>
#include <SDL.h>
#define BOOL u32
#define TRUE 1
#define FALSE 0
#define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 576
typedef Uint32 u32;
typedef Uint64 u64;
typedef Sint32 i32;
typedef Sint64 i64;
int main (int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *win = SDL_CreateWindow("Text Editor",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH, SCREEN_HEIGHT, 0);
assert(win);
SDL_Renderer *renderer = SDL_CreateRenderer(win, 0, SDL_RENDERER_SOFTWARE);
assert(renderer);
SDL_Texture *screen = SDL_CreateTexture(renderer,
SDL_PIXELFORMAT_RGB888,
SDL_TEXTUREACCESS_STREAMING,
SCREEN_WIDTH, SCREEN_HEIGHT);
assert(screen);
u32 *screen_pixels = (u32*) calloc(SCREEN_WIDTH * SCREEN_HEIGHT, sizeOf(u32));
assert(screen_pixels);
SDL_Delay(3000);
}
(its only 40 lines long)
If you could pleas explain what I am doing wrong (I am new to C), that would be very helpful! Thanks!
Aucun commentaire:
Enregistrer un commentaire