I have an application, which is written on C. A new functionality I need to add in C++. I build C application with GCC. To add new functionality:
To build an existing application with G++.
Add new functionality.
When I tried to do (1.), I met following problem: In file dev_table.c defined array:
const type_name devices[] = {...};
in file stm.c I export this array by:
extern const type_name devices[];
And when I assign
stm->dev = devices;
linker fail.
If I build the same code by GCC, everything is OK and working well, but with G++ it fails.
If I remove const
from both places(dev_table.c
and stm.c
), it is also working well, so the problem is resolved, but I do not understand what is the reason.