Forum Discussion
Altera_Forum
Honored Contributor
20 years agoC++ is IMPOSSIBLE in NIOSII
Hey Everyone, After spending over 20 hours trying everything that I could, I have concluded that it is impossible to have NIOSII run C++... If you want to define your own classes you need to in...
Altera_Forum
Honored Contributor
20 years agoI use classes all the time and have had no problems. I have not required IOSTREAM in any of my applications.
I have devised this quick test for you to see if the problem is with your Nios installation. Sorry if the instructions sound a bit basic but in the interests of an accurate test, I thought I should be thorough. 1. Start the IDE and make sure there are no open projects in the project tree. 2. Select File, New, C/C++Application 3. Select one of the Altera example designs in the "SOPC Builder System:" box e.g. "C:\altera\kits\nios2\examples\verilog\niosII_cyclone_1c20\standard\std_1c20.ptf" 4. Pick "Blank Project" as the project template and hit Finish. 5. Highlight "blank_project_0" (or whatever it called it) in the tree and select File, New, File. 6. Enter "Main.cpp" as the file name and hit Finish. 7. Paste the sample code below in the file and hit Project, Build All. If this does not compile, then I suggest that there must be a problem with your Nios installation. If this is the case then I am sure there are others watching, better qualified to comment. Good Luck.. class MyClass { public: int MyVariable; void MyMethod(void){}; }; MyClass TestClass; int main(void) { TestClass.MyVariable = 1; TestClass.MyMethod(); return 0; }