i can not write cpp instruction in my header files like usual CPP ide (visual cpp) does keil support class definition just in X.cpp file ?
No, it is still not clear!
Again, C++ does not have "instructions" - so you need to explain what, exactly, you mean by it here. Until you do that, it will remain unclear!
"seems is not supported in header by keil"
What makes it "seem" that way to you?
ie, from what evidence do you draw that conclusion?
ok ,ok when the extension of my source is .CPP every thing is ok ,i can use class create objects... but when extension is .h the compiler report error on code like class{} ...
The springing point isn't .h but how it gets _included_ - from c file, c++ file or an assembler file.
What have you done to convince the compiler that it should be in c++ mode?
maybe he's trying to compile a .h file...
Which isn't illegal with regards to the language. But stupid. And requires that the tool is informed that it should be processed as a cpp file.
Indeed.
"But stupid"
But I'm not sure we can rule-out the possibility in this case...
you can of course write C++ code in a header file, but if you do so then it can only be included from a C++ source file.
there are a few exceptions to this in Keil, since it supports some C++ features even when compiling a C file, such as C++ style comments and anonymous unions / structures.
this is actually really useful.
But of course if you are building a project with existing C files and want to start using C++ features then you have to take care also with name mangling, so it's probably better to simply tell uVision that all files are to be compiled as C++ anyway.
You can select the file type for any file in the project by changing it's options.
regards
Phil.
Thanks Phil . I changed the options and problem solved .
http://www.keil.com/forum/20725/