[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ compiling problems



I have some trouble with C++ compiling with the cris-gcc.

When I use a class as the one include below in this text the instance
MyClassInstance is NOT created when the program is started.
It is possible to create new instances while the program is running but the
static instance is for some reason not created.
The code works perfectly on a linux machine with gcc compiling but not on
etrax with cris-gcc.

Thanks in advance
Jan-Peter Nilsson

-- MyClass.h --

class MyClass {

	public:
	 MyClass();
	 ~MyClass();
	 int MyFunction1();
       int MyFunction2();

	protected:
	 int myVariable1;
       int myVariable2;
}

-- End MyClass.h --


-- MyClass.cpp --

#include "MyClass.h"

MyClass::MyClass() {
	myVariable1 = 3;
	myVariable2 = 7;
}

MyClass::~MyClass() {
}

int
MyClass::MyFunction1() {
	return myVariable1;
}

int
MyClass::MyFunction2() {
	return myVariable2;
}

MyClass MyClassInstance;

-- End MyClass.cpp --