This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bug in compiler

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!";
}

Parents
  • ...my complex one line program...

    Can the SDCC compiler do it? It,s based on GNU tools I think so can I use the GNU C++ with that?

    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++.

    --
    Joost

Reply
  • ...my complex one line program...

    Can the SDCC compiler do it? It,s based on GNU tools I think so can I use the GNU C++ with that?

    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++.

    --
    Joost

Children
  • 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?

  • I,ve been given some hardware with a display on it.

    ... and the compiler is supposed to know about this how ?

    A display makes a good console output.

    It's nice and human-readable, but way, way more complex than, say, a serial port.

    So I need it to go to the display.

    In that case, you'll need to write code that controls the display, or find some library that contains such code.

    The compiler doesn't know about the hardware you're using.

  • Anyway, I need to know of alternatives and not just get you can,t do it style comments.

    The alternative you should look at is what languages that the majority of all developers uses when using '51 chips.

    Some use C. Some use C. Then some use C. Most most of then tend to use C. Of the C users, some mixes in ore or less assembler, for the situations where a low-level high-level language is still too high-level.

    I haven't looked at the compiler you mention, but there have since the birth of C++ existed C++ front-ends - parsers that takes C++ code, and mangles it into C code for use by a compiler. C++ was originally developed with C-Front.

    Your simple line of code makes use of templates. I don't think you know too much about C++. If you did know C++, you would know the contents of the STL. You would know exactly how much code the compiler needs to mangle through to be able to decide what code to generate for that single line. You would also know how much run-time help that would be linked into your binary. On a PC, some compilers can manage to incorporate from 100k to more than 1MB for a trivial C++ binary that writes "Hello World" using cout.

    It is now up to you to use your professionalism to consider the value of filling up most of the processor code space with runtime library code - even before you have started to implement an application.

    Hint - how many microwave ovens have a need for a command line? How many intelligent battery chargers needs support for a path and environment variables? How many camera flashes needs a string datatype?

    There are many ways to fail a project. You can be among the few who fails even before you have started - just by deciding that the two plus characters are the most important aspect of the project... The choice is up to you. If this is a school job - why fail before starting? If it is for a business - think about the badwill of the failure!

  • 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.

    You'll probably need to do a bit more to get this working (display driver?).

    I know SDCC is a C compiler

    I wasn't sure because you didn't find this info for the Keil compiler.

    but it is based upon GPL code so I think maybe someone hitches it to the GCC compiler chain.

    I'm not sure what you mean with "hitching it to the GCC compiler". If you mean adding 8051 support to GCC (C++), I wouldn't call that "hitching" :-)

    So, basically your question is: "does anyone know a free (as in beer and speech) C++ compiler for the 8051?". Is that correct?

    --
    Joost