Hello all, I am trying to compile c++ code in Keil uVison3. Saving a file as .cpp causes all color formatting to dissappear, and code will not compile. There is no option to save as a cpp file either, i have to do it manually. there is an option that associates cpp file as c++ source, but .c++ extensions are not found in the file extension lists when i open or save a file. (i have to select *.* when i want to see the .cpp file)
I read another post that says saving as .cpp should be all that is needed. What gives? I need to be able to write classes, and this can not be done in c.
I need to be able to write classes, and this can not be done in c.
It can be done in C, it's just not as pretty. In fact, the first C++ compiler actually compiled C++ to C, and the output then had to be compiled with a C compiler.
There are C++ compilers for the 8051 out there, for example from Ceibo, if you absolutely have to use classes, but the whole concept is something the architecture of the '51 is not really suited for. Also, the C++ compiler will actually do "Embedded C++", which is a limited subset of C++ that you may or may not be satisfied with.
Classes just would have been nice to impliment a few ring buffers. There is more than one way to skin a cat though, i will deal. Thanks Tom
"Classes just would have been nice..."
So, as Neil surmised, you didn't really need classes - you just thought they would be "nice".
"...to impliment a few ring buffers"
Yes, plenty of people have been happily using ring buffers in plain ANSI 'C' without needing (or even wanting) classes...
"It can be done in C, it's just not as pretty. In fact, the first C++ compiler actually compiled C++ to C, and the output then had to be compiled with a C compiler."
Now why did you have to wake memories of Cfont :)
I believe that the Ceibo C++ compiler uses the same process. I may be wrong there, though.
Never looked at Ceibo C++. Should have written Cfront however... Not sure what Cfont is - Courier? ;)
View all questions in Keil forum