工具/软件:TI C/C++编译器
大家好,
我想使用C++来生成CCS 项目,但当我在 *.h文件中定义类时,如下所示:
*。h文件:
#ifndef main_work _H_
#define main_work _H_
#include "stdio.h"
#include <stdlib.h>
类Hjh
{
公开:
int add (int a,int b)(内部a,内部b)
{
返回(a + b);
}
};
#endif /* main_work _H_*/
和*。cpp文件:
/*
* main.cpp
*/
#include "iostream"
#include "stdio.h"
#include <stdlib.h>
包括"main_work.h"
extern "C" int main_work (void);
Int ax=0;
int main_work (void){
同时(1)
{
hjh hjh;
AX = hjh.add(1, 2);
}
}
但错误将弹出,如图所示:
为什么未定义类?
如果我在main.cpp中定义了如下所示的c代码,则没有任何错误:
/*
* main.cpp
*/
#include "iostream"
#include "stdio.h"
#include <stdlib.h>
包括"main_work.h"
extern "C" int main_work (void);
Int ax=0;
类Hjh
{
公开:
int add (int a,int b)(内部a,内部b)
{
返回(a + b);
}
};
int main_work (void){
同时(1)
{
hjh hjh;
AX = hjh.add(1, 2);
}
}
附件是我的project.e2e.ti.com/.../C_2B002B00_Pj.rar
谁能帮助我?