Itz*_*984 2 c c++ compiler-errors
当我尝试使用某个结构时,我得到"数据的存储大小"是不知道的.
码:
ioHelper.h:
#ifndef IOHELPER_H_
#define IOHELPER_H_
typedef struct fileValues data;
struct fileValues ioInput(FILE* file,int dim,int sign);
#endif /* IOHELPER_H_ */
Run Code Online (Sandbox Code Playgroud)
ioHelper.c:
struct fileValues
{
int dim;
char sign;
double x;
double y;
};
Run Code Online (Sandbox Code Playgroud)
map.c:
void drawData(FILE* vectors)
{
double paramLoc [MAX_DIMENSION];
char sign;
(this is where i get the error) struct fileValues data;
...
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
这是因为在编译map.c时,编译器无法在IoHelper.c中看到结构的完整定义.
您可能只包含IoHelper.h,它具有(不完整)声明,而不是定义.
所以你不能在map.c中声明那个结构类型的变量,除非你