This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with C++ functions

Hi all,
I use Keil uVision3.51 (with RVCT3.0), and work on a ARM7 project (I use LPC2364 mcu).

I have noticed strange behaviour with C++ classes.

In main.cpp, I have the code:

#include "test.h"
int main()
...
Test test;
...

If I declare test.h like this:
class Test
{ public: Test();
};

and test.cpp

Test::Test() {}

then the main program will crash on Test test; line.

If, instead, I move constructor body to class declaration in test.h:

class Test
{ public: Test() {}
};

Then main program constructs Test object without any problems. Since I am using a large C++ library, I would prefer not to move all function code to header files.

Can anyone please help me? What is going on? In my previous company we used RVCT on 200.000 LOC project without any problems.

Best regards,
Niksa

Parents Reply Children
No data