two or more data types in declaration specifiers
expected specifier-qualifier-list before ‘CloudType’
SDL_Surface* LoadImage(char *file) {
SDL_Surface *tmp;
tmp = IMG_Load(file);
if (!tmp) {
fprintf(stderr, "Error: '%s' could not be opened: %s\n", file, IMG_GetError());
exit(1);
return NULL;
}
return tmp;
}
error: invalid initializer
Sauer2 {l Wrote}:Done, the repository's name is 'falling'.
Sauer2 {l Wrote}:http://github.com/Sauer2/falling
struct global_s
{
//global things..
int somethingGlobal; //A global int
};
typedef struct global_s global_t;
//Function returns pointer to the global struct.
inline global_t getGlobal();
#include "globalstuff.h"
//declare the struct
global_t theActualStruct;
inline global_t getGlobal()
{
//Return the pointer to the struct (notice the & )
return( &theActualStruct );
}
#include "global.h" //Include the header
void whatEverFunctionNeedsAccessToGlobal()
{
getGlobal()->somethingGlobal=10; //access the struct member
printf("The value of the int somethingGlobal is %i\n", getGlobal()->somethingGlobal);
}
Users browsing this forum: No registered users and 1 guest