C++ code can't run to main function

In RVMDK3.05, I use simulator to debug C++ code, but it can't run to main function.
(Select LPC2292 in "Options for Target" dialog when creating project)

Sample code in test1.cpp as following:

class MYCLASS
{
  public:
        MYCLASS(){}
        ~MYCLASS(){}
};

MYCLASS myobject;
int main()
{
        while (1);

        return 0;
}

If we remove the destructor, it can run to main function.
Sample code in test2.cpp as following:

class MYCLASS
{
  public:
        MYCLASS(){}
  //    ~MYCLASS(){}   //remove this line
};

MYCLASS myobject;
int main()
{
        while (1);

        return 0;
}

Parents
  • Sounds like something that should be reported to Keil support.

    A global c++ object should have it's destructor address stored in a specific memory segment, so that the startup code can loop through all destructors after main() returns.

    On the other hand, an embedded project is normally not expected to end. There are no command line to return to, so there would normally not be too much use of global object destruction.

Reply
  • Sounds like something that should be reported to Keil support.

    A global c++ object should have it's destructor address stored in a specific memory segment, so that the startup code can loop through all destructors after main() returns.

    On the other hand, an embedded project is normally not expected to end. There are no command line to return to, so there would normally not be too much use of global object destruction.

Children
More questions in this forum