I,ve installed the Compiler and I can,t get even the simplest code to compile properely.
Anyone know where the fix for this bug is?
Or is it a limit of the demonstration version?
void main(void) { cout << "Hello world!"; }
So, if I pay for the compiler I will be able to compile this simple program.
No. Your program is written in C++. The Keil C51 is a C compiler. It will compile programs written in C, but not programs written in C++, Pascal, Fortran, Oberon, Smalltalk, or any other programming language that is not C.
Why is the demonstration version so limited?
The limits of the evaluation verison have nothing to do with the "problem" you have encountered.
Microsofts free compiler can do so much more!
Microsofts compilers cannot produce output that will run on an 8051. If you need your programs to run on an 8051, you will need to use something other than a Microsoft compiler.
So can you recommend to me a good cheap compiler that can do this simple job?
A free/cheap C++ compiler for the '51 ? Sorry. There is a C++ compiler, but it's not cheap or free. There are free compilers, but they do C, not C++.
How about you switch to programming in C instead of C++ ? Then you will have plenty of options. Maybe the evaluation version of Keil will actually suffice for what you are trying to do.
Someone give a more positive (and helpful) response please!
I know how to write code using cout and expect my compiler to do it. Why so difficult to get a simple answer?
you looking very rude and not good!!!!!
why you not be listening??
code with cout using c++ not c
keil is goodc c compiller and good for profesional 8051 programers
if ypou needing c++ for 8051 you specnd big money you think!!!!
looking at
www.ceibo.com/.../c prices.pdf
So, essentially you're asking "Please tell me what I want to hear." ?
All the information you need is already in this thread.
I know how to write code using cout and expect my compiler to do it.
If you use cout, then you are writing code in C++. "Your compiler", therefore, needs to be a C++ compiler. The Keil C51 is not a C++ compiler.
In simple terms, you're trying to pound a nail with a screwdriver. You are using the wrong tool for the job at hand.
Why so difficult to get a simple answer?
The simple answer is already in this thread. The problem is that you did not read, understand or believe it.
It looks pretty helpful to me... You want a C++ compiler but the Keil compiler isn't.
I believe your questions have been answered.
Are you aware that you are posting on an embedded toolset forum?
If you're simply looking for free stuff on a PC then check out the GNU compiler. http://gcc.gnu.org/ They also have their own forums for support.
-- Joost
I've found one at Ceibo :)
Even better is that they have a demo version.
www.ceibo.com/.../8051cpp.zip
I,ll give it a try and see if it does better than the limited Keil package.
I'm sorry to tell you this, but the Ceibo C++ compiler uses the Keil compiler. Any limits that the evaluation version of the C51 compiler has (regarding code size, memory map restrictions, etc) will thus be inherited by the "free demo" of the Ceibo compiler.
And since the evaluation version of C51 is limited to 4 kB code size, you will most likely run into problems when you use "powerful" (also known as "bloated") string output functions like cout or printf().
Are you aware that the Keil compiler will not produce any output that will run on a PC ? It is a compiler for 8051-based microcontrollers.
I like C++ for embedded work. I do not like to use the C++ libraries, because of their size.
Trying to use C++ to write code for a demo compiler with a 4kB limit is quite amusing. I whish you great luck. You will be very happy with your choice...
If your goal was to write programs for a PC, then good luck.
If you where really planning on writing programs for '51-chips, then I think it is time you try to read up on the processor architecture. Don't talk about limited compiler until you have figured out exactly how limited the processor is, when it comes to running high-level languages.
It's a bit interesting that whenever someone gives you an answer you don't like, you are rude towards them. Basically, you are the kind of guy would google for information. If the first 10 (or 100) links says something you don't like, you continue scanning links until someone gives the "correct" answer. Even the 100th link is at the 100th place because the contents of the document is wrong...
Why have a demo version that won,t compile my simple program?
Anyone got any other suggestions (please limit to ones that are both helpful and in English)?
Why have a demo of a C compiler that doesn't compile Ada?
Why have a demo of a C compiler that doesn't compile Pascal?
Why have a demo of a C compiler that doesn't compile Cobol?
Don't you still get it. C and C++ are two completely different programming languages. You may test any C compiler in the world. It doesn't matter. A C compiler just can not compile C++ programs. I say it once more: A C COMPILER IS COMPLETELY UTTERLESSY IMPOSSIBLY UNABLE TO COMPILE A C++ PROGRAM, SINCE C++ IS A COMPLETELY DIFFERENT LANGUAGE!!!
What does it take for you to realize that you are trying the wrong programming language?
Would it help if I say it in Swedish? En C-kompilator kan inte kompilera C++-program!
Other people on this forum might be able to help with other languages, since it seems obvious that you can't parse English...
What part of
"A C compiler will not compile C++ code."
is not clear to you ?
Even if you bought the full version of C51, it still would not compiler your C++ code, because
the C51 compiler is a C compiler.
Also, your program isn't "simple". It uses a string formatting and output function, and those are extremely powerful and complex, which translates into a very large code size. It can fill up a sizable portion of a 8051s memory without any problems.
For this reason, this type of function is usually avoided in embedded programming.
Thanks for your comments guys.
So, in brief, the demo of the Keil C compiler will not do what I want and nor will it even if I spend a few thousand bucks on it.
The ceibo might do it if I spend a few thousand bucks, but I cannot test it out on my complex one line program because it uses the Keil C compiler - Which (apparently) cannot compile C++ programs. This raises the question if Keil C cannot do it, why does ceibo come bundled with it?
Anyway, I need to know of alternatives and not just get you can,t do it style comments.
Can the SDCC compiler do it? It,s based on GNU tools I think so can I use the GNU C++ with that?
...my complex one line program...
Your trying to build your one line program for a 8051? Where will the "cout" output go?
From the website: SDCC is a retargettable, optimizing ANSI - C compiler
As stated in earlier posts: ANSI C is NOT C++.
Where will the "cout" output go?
cout = console output
I,ve been given some hardware with a display on it. A display makes a good console output.
So I need it to go to the display.
I know SDCC is a C compiler, but it is based upon GPL code so I think maybe someone hitches it to the GCC compiler chain.
Probable you think?
The ceibo might do it if I spend a few thousand bucks, but I cannot test it out on my complex one line program because it uses the Keil C compiler -
As I have said before: The problem you are going to run into if you use the Ceibo + Keil combination is that the evaluation version of Keil C51 only allows a code size of 4 kB. Any complex string formatting function (this includes printf and cout) will easily need upwards of 10 kB code space.
There's no need to use sarcastic bold letter. Any program that uses a string formatting function _is_ large and complex for a simple 8-bit microcontroller as the 8051.
This raises the question if Keil C cannot do it, why does Ceibo come bundled with it?
Because one way of compiling C++ programs is to use C as an intermediate step.
So a C++ compiler might translate a C++ program into a C program, and then a C compiler can be used to translate this C program to assembly. I would guess that this is the way Ceibo does it - this way they don't need to make their own C compiler (and they'll have a hard time trying to beat Keil or any of the other existing solutions).
If you had actually bothered to fully read the comments, you would have noticed several alternatives already. But I'll give you the list.
1. (this is not an alternative, but a prerequisite) Learn to extract useful information from human-readable text instead of being rude to the people who are, in fact, trying to help you. Use this skill to inform yourself about the particularities of the 8051 architecture (by reading the appropriate datasheets and the hardware documentation) and why C++ might not be a good language choice for this type of device. 2. Switch to a programming language that is more appropriate for a small device such as a 8051-type microcontroller. Plain C would be one such language. Your simple program would stay "simple", i.e. one line. (By the way, since you're trying to print text - where should the microcontroller output this text ? I did not see any intialization of an output device, for example a serial port)
I wouldn't think so. To make C usable on a 8051-type device, quite a few extensions need to be added to the C compiler. GNU C++ will not know these extensions. You may feel free to modify the GNU C++ compiler to your needs, however. It is free software, after all.