What's the solution for 'Incomplete type not allowed' ? / structure, c language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the solution for 'Incomplete type not allowed' ? / structure, c language

This is the structure I used: typedef struct Date struc_date; struct Date { int dd; int mm; int yy; } ; struc_date date; Until here declaration and definition all fine but when I use: scanf("%d", &date.dd); printf(" Your date : %d", date.dd); It gives me an error : incomplete type not allowed. What's the problem here? Can someone explain what exactly the problem here? Btw I am using Microsoft visual studio 2017.

21st Aug 2018, 11:50 PM
Ali Missaoui
Ali Missaoui - avatar
6 Answers
+ 3
ALi Missaoui I don't have vs 2017 with me, but it worked on app in playground for c language as below: #include <stdio.h> struct Date { int dd; int mm; int yy; } ; typedef struct Date struc_date; int main() { struc_date date; scanf("%d", &date.dd); printf(" Your date : %d", date.dd); return 0; }
22nd Aug 2018, 1:47 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
Ketan Lalcheta thanks bro I solve the problem my project was missing one header file 😂 damn I was so tired didn't notice that I didn't include the corresponding header file .h Kit D. Cat thanks for mentioning including my files 😄
22nd Aug 2018, 12:39 PM
Ali Missaoui
Ali Missaoui - avatar
0
Ketan Lalcheta any idea?
21st Aug 2018, 11:58 PM
Ali Missaoui
Ali Missaoui - avatar
0
Mohamed ELomari it's the same, it should be working in either ways but I dunno why it's giving me incomplete type error..
22nd Aug 2018, 12:17 AM
Ali Missaoui
Ali Missaoui - avatar
0
Np! thank you for trying to help me.
22nd Aug 2018, 12:23 AM
Ali Missaoui
Ali Missaoui - avatar
0
Yeah see! it should be working like that but when I am running the code with vs 2017 it's still giving me incomplete type error :/
22nd Aug 2018, 12:25 AM
Ali Missaoui
Ali Missaoui - avatar