Code:

#include <tice.h>

int main(void)
{
    os_ClrHome();

    uint8_t i;
    for (uint8_t i=0; i<100; i++){
        os_PutStrFull("Hello\n");
    }

    while(!os_GetCSC());

    return 0;
}



Why doesn't this code properly make? It gives many syntax errors. Is there anyway to program in C++ instead of C? And what version of C does the SDK use?
C89: https://github.com/CE-Programming/toolchain/wiki/FAQ#syntax-error-identifier-var-not-defined-within-current-scope

The toolchain will be released with llvm support soon which removes these limitations.
feverdreme wrote:

Code:

#include <tice.h>

int main(void)
{
    os_ClrHome();

    uint8_t i;
    for (uint8_t i=0; i<100; i++){
        os_PutStrFull("Hello\n");
    }

    while(!os_GetCSC());

    return 0;
}



Why doesn't this code properly make? It gives many syntax errors. Is there anyway to program in C++ instead of C? And what version of C does the SDK use?


The default version of the CE toolchain is the ZDS one, with a compiler by Zilog, that follows the C89 standard. One thing that isn't allowed in C89 for example is defining new variables not at the start of a block, so that uint8_t i; in your case. You can resolve this by moving its definition one line higher, and also remove the uint8_t from the for loop:

Code:
#include <tice.h>

int main(void)
{
    uint8_t i;
    os_ClrHome();

    for (i=0; i<100; i++){
        os_PutStrFull("Hello\n");
    }

    while(!os_GetCSC());

    return 0;
}

However, there is a community-developed alternative LLVM-powered toolchain in development which works decently well already and will hopefully be released soon (and also supports C++, for example). It is already usable though. Like Mateo says,
MateoConLechuga wrote:
The toolchain will be released with llvm support soon which removes these limitations.
...however it's been "soon" for several months now. You'd be best off using the prerelease and helping its development by looking for bugs too. github
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement