Tool/software: TI C/C++ Compiler
Hi Guys,
I wanna use the C++ to build the ccs project, but when i define the class in the *.h file,such as below:
*.h file:
#ifndef MAIN_WORK_H_
#define MAIN_WORK_H_
#include "stdio.h"
#include <stdlib.h>
class HJH
{
public:
int add(int a, int b)
{
return (a + b);
}
};
#endif /* MAIN_WORK_H_ */
and the *.cpp file:
/*
* main.cpp
*/
#include "iostream"
#include "stdio.h"
#include <stdlib.h>
#include "main_work.h"
extern "C" int main_work(void);
int ax=0;
int main_work(void) {
while(1)
{
HJH hjh;
ax = hjh.add(1, 2);
}
}
but the error will pop up shown as the picture:
why the class is undefined?
and if i defined the c code shown as below in the main.cpp,there is not any error :
/*
* main.cpp
*/
#include "iostream"
#include "stdio.h"
#include <stdlib.h>
#include "main_work.h"
extern "C" int main_work(void);
int ax=0;
class HJH
{
public:
int add(int a, int b)
{
return (a + b);
}
};
int main_work(void) {
while(1)
{
HJH hjh;
ax = hjh.add(1, 2);
}
}
the attachment is my project.C++Pj.rar
who can help me ?