2015-08-17 103 views
-5
#pragma once 

#include <stdio.h> 

#define internal static 
#define local_persist static 
#define global_variable static 

#define false 0 
#define true 1 

typedef int8_t int8; 
typedef int16_t int16; 
typedef int32_t int32; 
typedef int64_t int64; 
typedef int32 bool32; 

typedef uint32_t uint32; 

void Update(void); 
void Render(void); 

>------ Build started: Project: Shattered, Configuration: Debug x64 ------ 
1> main.c 
1> shattered.cpp 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(12): error C2146: syntax error : missing ';' before identifier 'int8' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(13): error C2146: syntax error : missing ';' before identifier 'int16' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(14): error C2146: syntax error : missing ';' before identifier 'int32' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(15): error C2146: syntax error : missing ';' before identifier 'int64' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(16): error C2146: syntax error : missing ';' before identifier 'bool32' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(16): error C2378: 'int32' : redefinition; symbol cannot be overloaded with a typedef 
1>   c:\users\zak\desktop\shattered\shattered\shattered.h(14) : see declaration of 'int32' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(18): error C2146: syntax error : missing ';' before identifier 'uint32' 
1>c:\users\zak\desktop\shattered\shattered\shattered.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

所以這是我的代碼我得到的輸出是說它不知道int8的類型,當我清楚地包括stdio.h。Typedef缺少類型說明符

任何幫助將不勝感激!

+0

你使用什麼編譯器?你在編譯什麼系統? –

+2

我認爲你的意思是'typedef int8 int8_t;' –

+0

'#include ',在谷歌搜索框中拋出'int8_t'會告訴你它聲明瞭哪個頭(以及所有其他的頭)。 – WhozCraig

回答

3

您應該#include <stdint.h>它有這些類型的定義。

+0

Omg我覺得很愚蠢。我發誓我寫了stdint。謝謝 –