error C1044 Constructor required    with a struct?????

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

error C1044 Constructor required    with a struct?????

3,326 Views
Bobcat
Contributor I
  Anybody have any idea why I would get an error C1044 when I am declaring a typedef of a struct.....not a class.   This is a simple data storage structure in C....  is this a bug???
 
 Thanks.
Labels (1)
0 Kudos
2 Replies

405 Views
CrasyCat
Specialist III

Hello

Are you building with option -C++?

This message will come if you build with C++ only.

I would not recommend C++ for a HC12 application. CodeWarrior Front End does not fully support C++. I would rather recommend EC++.

CrasyCat

0 Kudos

405 Views
CompilerGuru
NXP Employee
NXP Employee
First, in C++ the only difference between struct and class is the initial accessibility.

The following is, for example not allowed in C++:
struct A {
const int c_i;
};

A a;

In C++, all const members have to be explicitely initialized.
The compiler wont generate anything to init them, and if they are not init, its an error....

Here's a possible way to write it in C++:
struct A {
int i;
};

const A a= {1};

C++ is not just C, its a different language. If you want to use C, use C :smileyhappy:

Daniel
0 Kudos