Altera_Forum
Honored Contributor
16 years agoClass design in Nios II with uC/OS
Hi i am a newbie on the NIOS II themes and i need to create a object oriented program on a NiosII system with uC/OS. I have NIOS II ide V9.0SP2 with a Nios II development kit.
In order to make my first test i use the hello world example without OS and the class was designed using the New C++ class wizard of the Nios II ide, here the code://hello_world.c
16 # include "miclase.cpp"
17 # include <stdio.h>
18
19 int main()
20 {
21 miclase clase;
22 clase.miclase();
23 printf("Hello from Nios II!\n");
24
25 return 0;
26 }
//miclase.cpp
2 # include "miclase.h"
3 miclase::miclase(){}
4
5 miclase::~miclase(){}
//miclase.h
2 # ifndef MICLASE_H_
3 # define MICLASE_H_
4 class miclase
5 {
6 public:
7 miclase();
8 virtual ~miclase();
9 };
10 # endif /*MICLASE_H_*/ when I build all the compiler throw this errors: error: `clase' undeclared (first use in this function) hello_world.c line 22 error: `miclase' undeclared (first use in this function) hello_world.c line 21 error: syntax error before ':' token hello_world_1 miclase.cpp line 3 error: syntax error before '{' token hello_world_1 miclase.h line 5 error: syntax error before "clase" hello_world_1 hello_world.c line 21 error: syntax error before "miclase" hello_world_1 miclase.h line 4 :confused: I dont know what to do because when I use similar code on the Hello world with uC/OS and the class declaration, the compiler throw the same errors. Later I check the check box Support C++ on the system Library Properties and the erros continue. So my final question is: How can i implement a full class design (with inheritance, template classes and so) on the Nios II development kit working with uc/OS II.