Error:Incomplete type and not allowed(Problem in returning structurevariable)

S

sharat

Hi all.

I am writing a a code in c++ . i have defined a global structure in a
header file(user define header file) say headerfile1.h and declared a
class in file2.h which is having some public funtion which returns the
struct variable and definition of the fun in in file1.cpp .
I am getting the error in compilation that "struct_var' has
incomplete type and not allowed and return type is incoplete. If i am
trying to return the structure pointer instead of variable it is
compiling without error but returning structure variable is creating
problem.

Kindly help to solve the problem.

Thanx in advance
 
C

coal

Hi all.

I am writing a a code in c++ . i have defined a global structure in a
header file(user define header file) say headerfile1.h and declared a
class in file2.h which is having some public funtion which returns the
struct variable and definition of the fun in in file1.cpp .
I am getting the error in compilation that "struct_var' has
incomplete type and not allowed and return type is incoplete. If i am
trying to return the structure pointer instead of variable it is
compiling without error but returning structure variable is creating
problem.

Kindly help to solve the problem.

Thanx in advance


It sounds like you haven't included headerfile1 in file2.h or
at least in the .cpp file. If that doesn't help post the
code here.

Brian Wood
Ebenezer Enterprises
www.webebenezer.net
 
S

sharat

i have included the header file . actually file is included in main .
For my project i am having one header file which contatins all the
global structures to be used in the code ,all other .h and .cpp files
uses these structures. If i am including comman header file in each
(other different) header files it is giving redefinition
error.Including in main is not solving the purpose. I can extern the
structure and use in the perticular class which i want but i want some
other method then extern . if unable to get the problem i'll post the
code but i think this solve the purpose . Kindly help .thanx in
advance .
 
S

sharat

i have included the header file . actually file is included in main .
For my project i am having one header file which contatins all the
global structures to be used in the code ,all other .h and .cpp files
uses these structures. If i am including comman header file in each
(other different) header files it is giving redefinition
error.Including in main is not solving the purpose. I can extern the
structure and use in the perticular class which i want but i want some
other method then extern . if unable to get the problem i'll post the
code but i think this solve the purpose . Kindly help .thanx in
advance .
 
J

Jim Langston

sharat said:
i have included the header file . actually file is included in main .
For my project i am having one header file which contatins all the
global structures to be used in the code ,all other .h and .cpp files
uses these structures. If i am including comman header file in each
(other different) header files it is giving redefinition
error.Including in main is not solving the purpose. I can extern the
structure and use in the perticular class which i want but i want some
other method then extern . if unable to get the problem i'll post the
code but i think this solve the purpose . Kindly help .thanx in
advance .

quote "... If that doesn't help post the code here."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top