unfortunately iostream is not available to uClinux (is it from libstdc++.a? better to check this). I should have pointed that out in the previous post.
Currently the making of flat executable doesn't go through the final link, so unresolved symbols are not reported during that process. But the gdb file (.gdb) does go through the final link, so you can make the .gdb file at the same time to check if all symbols are resolved. If the generation of the gdb file fails, the flat file contains unresolved symbols, and will hang the system if you run it on uClinux.
One of my C++ test on uClinux, function.cpp, is as follows,
// overloading class member functions# include <stdio.h>
//rectangle class declarartion
class Rectangle
{
public:
//constructors
Rectangle(int width, int height);
~Rectangle(){}
// overloaded class function DrawShape
void DrawShape() const;
void DrawShape (int aWidth, int AHeight) const;
private:
int itsWidth;
int itsHeight;
};
//constructor implementation
Rectangle::Rectangle(int width, int height)
{
itsWidth = width;
itsHeight = height;
}
// overloaded DrawShape - takes no values
// draws based on current class member values
void Rectangle::DrawShape() const
{
DrawShape(itsWidth, itsHeight);
}
// overloaded DrawShape - takes Two Values
// draws shape based on the parameters
void Rectangle::DrawShape(int width, int height) const
{
for (int i = 0; i<height; i++)
{
for (int j = 0; j< width; j++)
{
printf( "*");
}
printf( "\n");
}
}
// driver program to demonstrate overloaded functions
int main()
{
//initialize the rectangle to 30,5
Rectangle theRect(30,5);
printf("DrawShape(): \n");
theRect.DrawShape();
printf("\nDrawShape(40,2): \n");
theRect.DrawShape(40,2);
return 0;
}
You can have a try,
regards,
wentao