Issues with Keil, C++ and C99 mode
Posted: Thu Sep 17, 2015 10:31 pm
I have been unable to get a C++ project to link properly using Keil 5.16a. I suspect it's the requirement to use C99 mode that is causing the problems. It links without errors but does not include all of the code that it should. I have the following test program:
test_thread functions that I don't explicitly call ( like the constructor or main ) don't get compiled in. Functions like set_x that I explicitly call work correctly.
Anyone run into this?
Code: Select all
#include "ch.hpp"
using namespace chibios_rt;
class test_thread : public BaseThread
{
public:
test_thread(void)
{
x = 0;
}
virtual void main(void)
{
while(1)
{
chThdSleepMilliseconds(500);
++x;
}
}
void set_x(int xx)
{
x = xx;
}
private:
volatile int x;
};
test_thread test1;
volatile int y;
int main(void)
{
System::init();
test1.set_x(5);
test1.start(9);
while(1)
{
++y;
}
}
test_thread functions that I don't explicitly call ( like the constructor or main ) don't get compiled in. Functions like set_x that I explicitly call work correctly.
Anyone run into this?