Hi There,
I wonder if anyone can help.
I've had a look to see if I can find any old messages to help with my problem, but couldn't locate any.
Anyway, I am using the C167 EC++ compiler to create a very simple class to encapsulate a new data type based upon an int.
(I have already done a very simple C implementation but need the C++ equivalent...)
The class looks like this (very simplified!)
class test { public: int i; test(void) { i=0; } test(const int v) { i=v; } // Other functions here... };
Now, when declaring objects as single instances of the class it gives no problems:
test j,k=10;
But when I declare an array of these objects (like test j[5], k[2]={10,5};) I get linker errors such as those listed below.
However, if I remove the constructors I get no such problems and the objects seem to operate as expected (but obviously I cannot initialise the objects with any values…)
Any ideas?
Many thanks in advance,
Michael
Sample of linker errors:
*** WARNING L20: DATA TYPES DIFFERENT SYMBOL: __vec_new MODULE: duplex_tbyte.obj (DUPLEX_TBYTE) *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: __nw__FUi MODULE: duplex_tbyte.obj (DUPLEX_TBYTE) *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: __nw__FUi MODULE: duplex_tbyte.obj (DUPLEX_TBYTE) ADDRESS: 0914H
Hi Thomas,
thanks for the reply.
Yes, I've tried this and get the same problem.
Surprisingly, even this code throws up a linker error:
class test {
};
test i[2]={test(),test()};
I pretty sure it must be something to do with the C++ pre-processor messing up the symbol names when arrays are used - a direct port works fine on a destop compiler.
I will ask Keil directly to see if there is a patch or something.
Thanks,