编译器版本:TI v15.12.1.LTS
家庭:ARM
型号:Tiva TM4C123GH6PM
当尝试在 main.c 中构建 c++ 类时,出现以下错误
**** Build of configuration Debug__TI for project Lab1 ****
"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building file: ../Generic.cpp'
'Invoking: ARM Compiler'
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --diag_wrap=off --diag_warning=225 --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="Generic.d" "../Generic.cpp"
'Finished building: ../Generic.cpp'
' '
'Building file: ../main.c'
'Invoking: ARM Compiler'
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --diag_wrap=off --diag_warning=225 --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="main.d" "../main.c"
>> Compilation failure
subdir_rules.mk:14: recipe for target 'main.obj' failed
"..\Generic.h", line 11: error #20: identifier "class" is undefined
"..\Generic.h", line 11: error #66: expected a ";"
"..\Generic.h", line 15: warning #12-D: parsing restarts here after previous syntax error
"../main.c", line 6: error #20: identifier "generic" is undefined
3 errors detected in the compilation of "../main.c".
gmake: *** [main.obj] Error 1
'Building file: ../tm4c123gh6pm_startup_ccs.c'
'Invoking: ARM Compiler'
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --diag_wrap=off --diag_warning=225 --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="tm4c123gh6pm_startup_ccs.d" "../tm4c123gh6pm_startup_ccs.c"
'Finished building: ../tm4c123gh6pm_startup_ccs.c'
' '
gmake: Target 'all' not remade because of errors.
**** Build Finished ****
课程详情如下:
主程序
#include "Generic.h"
int main(void) {
Generic *generic;
return 0;
}
通用.cpp
#include "Generic.h"
Generic::Generic() {
// TODO Auto-generated constructor stub
}
Generic::~Generic() {
// TODO Auto-generated destructor stub
}
通用的.h
#ifndef GENERIC_H_
#define GENERIC_H_
class Generic {
public:
Generic();
virtual ~Generic();
};
#endif /* GENERIC_H_ */
我不确定我们是否需要将 main.c 转换为 main.cpp。如果是这样,那么需要为 main.cpp 更新哪个 make 文件
有关 ARM 的 c++ 编译的任何帮助