Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

C++ classes...

Hey Guys,

is it possible to do object oriented programming in NIOSII?

when I define a simple class in a .h or .hpp file, I get syntax

errors all over the place....

I even get errors for using the word "class"...

can someone please provide some insight into whether it is

even possible to program C++ in NIOSII?

thanks,

Aydin.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have not had any problems. I just rename the file created by the new application wizard from a .c to a .cpp file (hello_world.c or whatever) and it works fine.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    That is not the problem... I am having trouble declaring my own classes...

    I want to be able to declare a really simple class...

    however, in order to declare a class, I need to include iostream

    and this I cannot do properly....

    if there is anyone out there that has been able to run a very simple

    c++ program, please please explain how you can include iostream...# include <iostream>

    does not work...

    thanks,

    aydin_y_mirzaee@yahoo.com
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by aym35@Nov 15 2005, 04:36 PM

    hey guys,

    is it possible to do object oriented programming in niosii?

    when i define a simple class in a .h or .hpp file, i get syntax

    errors all over the place....

    i even get errors for using the word "class"...

    can someone please provide some insight into whether it is

    even possible to program c++ in niosii?

    thanks,

    aydin.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11002)

    --- quote end ---

    --- Quote End ---

    I noticed the compiler behaves different if the file extention is ".c" instead of ".cpp".

    I had trouble wheni included a header containing cpp in a normal c file.

    Otherwise cpp works fine.

    Karsten
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Similarly, the compiler will treat ".c" and ".C" differently.

    -Joel-

    I noticed the compiler behaves different if the file extention is ".c" instead of ".cpp".

    I had trouble wheni included a header containing cpp in a normal c file.

    Otherwise cpp works fine.

    Karsten