Error #20 Identifier Class Is Undefined
Contents |
30 Days In the Last 90 Days In the Last 6 Months Home/Discussion Forum C++, works maybe? Next Thread | Thread List | Previous Thread Start
Identifier Class Is Undefined Code Composer
a Thread | Settings Details Message Read-Only AuthorLeon Montgolf Posted11-Sep-2008 22:00 GMT ToolsetARM identifier class is undefined c++ C++, works maybe? Leon Montgolf I put a simple class in a file named "test.h". The class is as follows: identifier "class" is undefined keil class a { public: int b; }; I am using the Keil MCBSTM32 board (STM32F103RB processor). I place this file in "C:\Keil\ARM\Boards\Keil\MCBSTM32\Timer". I then open the timer project. If I include the
Identifier Class Is Undefined Iar
file in timer.c I get the following error: Build target 'MCBSTM32' compiling Timer.c... test.h(2): error: #20: identifier "class" is undefined test.h(2): error: #65: expected a ";" Target not created Why does it give me an error? I thought the compiler ssuported C++? Read-Only AuthorAndy Neil Posted11-Sep-2008 23:17 GMT ToolsetARM RE: If I include the file in timer.c Andy Neil Many compilers look at the file type (extension) to decide whether they should be treated as C++ or ANSI 'C' Commonly, .c is taken to mean ANSI 'C' - so you would expect to get errors from C++ stuff... What does the Manual say? Read-Only AuthorLeon Montgolf Posted12-Sep-2008 14:15 GMT ToolsetARM RE: If I include the file in timer.c Leon Montgolf As far as I could determine the Manual or nothing I was able to locate with a search in this forum said anything on C++ compilation, therefore the question. I did not realize that there was a possibility that the extension had anything to do with the compilers ability to recognise C++. I have worked with compilers where you could intermix C and C++ in ".c" file. Most of the time I have worked exclusively in either C or C++. I must admit, I have never tried this particular scenario.
Timing Data Converters Development Tools Digital Signal Processors (DSP) DLP® Products & MEMS Embedded Software Interface Isolation Logic Microcontrollers OMAP™ Applications Processors (Read Only) Power Management RF & Digital Radio Sensor Products Haptics & Touch Wireless Connectivity /etc Support Blogs Analog Wire Analog: The real world Behind the Wheel ConnecTIng Wirelessly Enlightened: The TI DLP® Blog Fully Charged Industrial Strength Launch Your Design Learn E2E Motor Drive & Control MSP Low-Power Plays On the Grid Power House Precision Hub The Process Think. Innovate TI Live @... Tools Insider University Program Groups Corporate Citizenship http://www.keil.com/forum/13186 TI University Program Russian E2E (сообщество E2E) Japanese E2E (日本語コミュニティ) Learn E2E Launch Your Design Motor Drive & Control Videos More Cancel TI C/C++ Compiler TI C/C++ Compiler - Forum Mentions Tags More Cancel Sign In to Post Sign In to Post Cancel Go to Development Tools Forums Amplifiers Switches & Multiplexers Applications Processors Clock and Timing Data Converters Development Tools Digital Signal https://e2e.ti.com/support/development_tools/compiler/f/343/p/239785/841767 Processors (DSP) DLP® Products & MEMS Embedded Software Interface Isolation Logic Microcontrollers OMAP™ Applications Processors (Read Only) Power Management RF & Digital Radio Sensor Products Haptics & Touch Wireless Connectivity /etc Support More Cancel TI C/C++ Compiler Resources Compiler Wiki Bug tracking CCS Youtube Channel Answered error: identifier "class" is undefined Genius 3380 points Silver Diamond I also posted this on MSP430 Forum, but so far no response, but I have following output error: identifier "class" is undefined So far I tried everything, including renaming main.c to main.cpp and in Project => options => Build => MSP430 Compiler => Advanced Options => Language Options => Treat C files as C++ file My target is MSP430FR5939, and I am using free version of CCS5. Does free version support C++? We are considering switching to this hot new controller, but I cant get started with it, do I need to buy CCS seat or is this CCS bug? Am I doing something wrong. Below is the listing of the class, it chokes on "class" class CharQueue{private:void start_pp(); // incruments start pointervoid end_pp(); // incruments end pointer// shoudl be privateunsigned i
keil STM32 Modify settings and columns STM32 - ARM Cortex-M 32-Bit MCU Actions Share Discussion View: Flat Posted ByPost Started: 12/27/2014 3:05 PMView Properties/AttachmentsReplymahmoud https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/error%20in%20adding%20cpp%20library%20to%20c%20project%20in%20keil Posts : 29error in adding cpp library to c project in keilhi every oneim trying to develop a c project in keil ,know i need to add a cpp library file to project & it shows error,i think it is because project uses c compiler & it cant compile cpp libraries,but i dosent have any suggestion to what is undefined i must do !keils error : error: #20: identifier "class" is undefinedlibrary consist of a lib_XX.h file (for example ) & lib_XX.cpp file & like any other libraries i include .h file in main.c (my main program file )#include "lib_XX.h"-----libraries dosent have any problem & i used them in keil cpp project before.is there any suggestion ?best regards,Mary christmasMahmoudShare PostPosted: 12/27/2014 3:36 identifier class is PM 1View Properties/AttachmentsReplymajerle.tilen Posts : 101C and C++ are not the same languages! You cannot combine them together."class" word does not exists in C.You have 2 options:1. Convert your cpp file to C or2. Do entire project in C++Show Quoted MessagesShare PostEdited: 12/28/2014 8:28 PMView Properties/AttachmentsReplymahmoud Posts : 29actually im trying to convert my last project to cpp but there is a problem too:im using this GLCD library to initial ks0108 GLCD with stm32f103 , every thing is ok except GLCD_Bitmap functionvoid GLCD_Bitmap( const unsigned char * bmp, unsigned char x, unsigned char y, unsigned char dx, unsigned char dy){unsigned char i, j;for(j = 0; j < dy / 8; j++) { GLCD_GoTo(x,y + j); for(i = 0; i < dx; i++) GLCD_WriteData(GLCD_ReadByteFromROMMemory(bmp++)); }}it draws a stored image,GLCD_WriteData function dosent have any problem because other functions used it correctly.this function declared on ks0108.c file when there is not declaration of this function on ks0108.h (void GLCD_Bitmap( const unsigned char * bmp, unsigned char x, unsigned char y, unsigned char dx, unsigned char dy);) compiler show this warning but program run correct .warning: #223-D: function