Hi! I just picked up C and CSFML and I'm having some issues loading textures. My compiler is telling me that sfTexture is an incomplete type. The error in question:
||=== Build: Release in Crucis (compiler: GNU GCC Compiler) ===|
C:\Users\Platino\Documents\C\Crucis\src\window.c||In function 'loadTextures':|
C:\Users\Platino\Documents\C\Crucis\src\window.c|113|error: invalid use of undefined type 'struct sfTexture'|
C:\Users\Platino\Documents\C\Crucis\src\window.c|113|error: dereferencing pointer to incomplete type|
C:\Users\Platino\Documents\C\Crucis\src\window.c|114|error: invalid use of undefined type 'struct sfTexture'|
C:\Users\Platino\Documents\C\Crucis\src\window.c|114|error: dereferencing pointer to incomplete type|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
From what I understand, there is a declaration but no implementation of sfTexture? I'm confused as to why this is an issue. I've been using sfRenderWindow, sfRectangleShape and sfVertexArray from the same header with no problems. Am I doing something wrong? Here is the simplified code from window.c:
sfTexture* textures;
int texturenum = 2;
void loadTexture(void)
{
textures = malloc(sizeof(sfTexture*) * texturenum);
memset(textures, 0, sizeof(sfTexture*) * texturenum);
const char* filepath = "../img/tiles.png";
textures[0] = sfTexture_createFromFile(filepath, NULL); // Line 113
if(textures[0] == NULL) // Line 114
ERROR("Failed to load texture: ", filepath);
}
There's a lot going on with loading filenames from JSON and such, but I've triple-checked that's working correctly. Have I not correctly installed CSFML?