Hey Guys I got a Compile Error in my C Project with a Function Pointer.
Thank you for your help :)
Folder Structure:
Main Folder: enter image description here
Lib Folder: enter image description here
Heder Folder:
Path : C-Lib/Headers
File(s) : ShowPointer.h
Code (Main.c):
#include <stdio.h>
#include "./Headers/ShowPointer.h"
int main(){
printf("Hej this is written in VIM some C code.\n");
getchar();
}
Code (ShowPointer.c):
#include <stdio.h>
#include "../Headers/ShowPointer.h"
void ExPointer(int *pPointer, int *pPointerMax){
for (int i = *pPointer; i<*pPointerMax; i++){
printf("%d. %d %p\n", i, *pPointerMax-i, pPointerMax);
}
getchar();
}
Code (ShowPointer.h):
#ifndef SHOWPOINTER_FILE
#define SHOWPOINTER_FILE
typedef void ExPointer (*)(int , int);
#endif
Compile: I do Compile this Project whit this code:
gcc -o main main.c Lib/ShowAddress.c
Error: Out come of the Compile error text (code):
In file included from main.c:2:0:
./Headers/ShowPointer.h:4:25: error: expected declaration specifiers or ‘...’ before ‘*’ token
typedef void ExPointer (*)(int , int);
^
In file included from Lib/ShowAddress.c:2:0:
Lib/../Headers/ShowPointer.h:4:25: error: expected declaration specifiers or ‘...’ before ‘*’ token
typedef void ExPointer (*)(int , int);
Sorry for me bad English.