2016-05-31 2 views
0
версия

компилятора: TI v15.12.1.LTSC++ Ошибка компиляции для класса в коде композитор студии руки

Семейство: ARM

Varient: класс Tiva TM4C123GH6PM

Когда попытка построить 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 **** 

детали класса являются:

main.c

#include "Generic.h" 

int main(void) { 

    Generic *generic; 
    return 0; 
} 

Generic.cpp

#include "Generic.h" 

Generic::Generic() { 
    // TODO Auto-generated constructor stub 

} 

Generic::~Generic() { 
    // TODO Auto-generated destructor stub 
} 

Generic.h

#ifndef GENERIC_H_ 
#define GENERIC_H_ 

class Generic { 
public: 
    Generic(); 
    virtual ~Generic(); 
}; 

#endif /* GENERIC_H_ */ 

Я не уверен, нужно ли нам сделать main.c в main.cpp. Если это так, то, что делает потребность файла обновляется main.cpp

Любая помощь на C++ компиляции для ARM

+0

'armcl' похоже, имеет параметр командной строки' --cpp_default', вы можете попробовать это, если вы абсолютно не можете переименовать свой main.c –

ответ

0

От форума TI:

По умолчанию компилятор TI ARM использует расширение файла для определения того, для компиляции исходного кода как C или C++. Если это проект CCS, вы можете просто переименовать main.c в main.cpp, и сгенерированный make-файл CCS будет обновлен автоматически.

Это работает сейчас. Благодарю.

Смежные вопросы