Questions tagged [incomplete-type]

In the C and C++ languages, an incomplete type is "lacking sufficient information to determine the size of objects of that type." (Examples: variable-length arrays, forward declarations of `struct`s, and the `void` type.)

In the C and C++ programming language, an incomplete type is

"lacking sufficient information to determine the size of objects of that type."ISO C11 standard, section 6.2.5

Examples:

The standard mentions the following three instances of incomplete types:

  1. an array type of variable, or unknown size, such as char *argv[].
  2. a type that describes an object but lacks information to determine their sizes, such as struct foo_tag;
  3. the void type (which, unlike the other two, cannot be completed)

Resources:

310 questions
0
votes
1 answer

Incompatible pointer type in C. C arrays and pointers

I have been getting a compiler error incompatable pointer type. Here is the code. #define MAX_WORDS 10000 #define MAX_CHAR_PER_WORD 100 char textn[MAX_WORDS][MAX_CHAR_PER_WORD]; void foo(char *text[], int nlines){ // Code } int main(){ …
Pavan
  • 2,427
  • 4
  • 15
  • 18
0
votes
2 answers

c99 Dereferencing pointer to incomplete type

I have this in input_lib.c: #include "input_lib.h" struct edge { int from; int to; }; input_lib.h contains my typedef: typedef struct edge edge; Then in another file which includes input_lib.h, I declare a variable and attempt to use…
Brian Ecker
  • 1,677
  • 1
  • 18
  • 29
0
votes
1 answer

Dereferencing pointer to incomplete type

I am getting the following error from this piece of code, I am new to C and learning as I go along! cc -g -I /usr/lib/i386-linux-gnu -c anld.c anld.c: In function ‘main’: anld.c:379:11: error: dereferencing pointer to incomplete type Main .C…
TomSelleck
  • 6,233
  • 18
  • 71
  • 132
0
votes
1 answer

Referencing struct definition inside class in CRTP

I'm using static polymorphism (CRTP method) to create class hierarchy. The idea is to use a struct defined in derived class in base one. However, VC10 generates following error: error C2039: 'param_t' : is not a member of 'D' and Intel C++ generates…
0
votes
3 answers

invalid use of incomplete type in handling exceptions

How to implement the following without troubles connected with "invalid use of incomplete type"? class A { // line#10 /*(...) some fields and methods here. */ // more fields of the following functionality exist, storing data about object A's…
yauser
  • 667
  • 2
  • 8
  • 17
0
votes
1 answer

C++ Calling interface method cause pointer-to-incomplete in VS2012

I have a problem using the interface A. While trying to call the Initialize() function on any pointer stored in the vector aVec VisualStudio says "Error: The classtype pointer-to-incomplete is not valid". Does anybody know how to implement this…
Xenogenesis
  • 360
  • 4
  • 23
0
votes
2 answers

Field Has Incomplete Type, Compiling From Multiple Files

I am trying to compile several files together for an agent based simulation of a zombie apocalypse (Awesome, right!?) Anyway, I am getting an error that I think has to do with the order in which header files are being included, but I can't wrap my…
BrownBeard93423
  • 161
  • 4
  • 14
0
votes
1 answer

Determining shared pointer Type class Incomplete or complete and the reason of crash

A class constructor has the declaration like this... Class A: { public: A(int a, SharedPtrsp = SharedPtr()); ~A(); } Now from another class I am destroying this class as shared pointer like delete (SharedPtr*)(*iter); Now…
Robel Sharma
  • 917
  • 1
  • 10
  • 26
0
votes
1 answer

using make_shared with incomplete types

I am trying to switch my code to use make_shared() but I have a lot of incomplete types (complete at the time of creation) and was wondering if there is anyway make_shared would work with incomplete types or allow me to pass a deleter type. I…
Sharad
  • 1
  • 1
0
votes
1 answer

Referring to other instance of class A in class A

I'm having this (part of) code in my header class Node { Node prevNode; public: Node(float nodeXRotation, float nodeYRotation, float nodeZRotation, float boneLength, float xOffset, Node prevnode); } But its…
Myth1c
  • 619
  • 1
  • 7
  • 23
-1
votes
1 answer

Error: aggregate has incomplete type and cannot be defined

I am writing a program for bank and I m getting this error when I compile it. This is my entire code as i was not able to share more code here it is on paste bin. My code I am not including my whole code but the part I think is…
-1
votes
1 answer

Problem with inlining functions gives "Member access into incomplete type" compiler error

I have an issue with implementing inline functions in one of my classes. I have successfully inlined functions for one of the classes that this class manages as follows: static bool filterInfected( Person* p ) { return p->isInfected(); } the…
-1
votes
4 answers

If struct type is defined in another .c file, it becomes incomplete type?

I can have no problem with this code: #include struct foo { void * data; }; int main() { printf("%ul\n", sizeof(struct foo)); } but once, the struct is declared in another file and provided to compiler, the struct will magically…
milanHrabos
  • 1,577
  • 1
  • 2
  • 12
-1
votes
2 answers

incompatible types in assignment of 'char[10]' to 'char [50]'

I am always taking these "incompatible types in the assignment of 'const char [5]' to 'char [50]'" or like that problem. #include #include struct Lessons{ char name[50]; float note; int credit; …
Joseph
  • 1
  • 4
-1
votes
4 answers

Argument type 'void' is incomplete

I'm trying to code this relatively simple code in which I want to be able to change the value of set_current. The error message: "Argument type 'void' is incomplete" keeps showing up and I'm not sure why. I am not an experienced coder but I have to…
Lilly S
  • 27
  • 1
  • 1