Altera_Forum
Honored Contributor
21 years agoC++ Application
I was hoping someone out there is using Standard C++ on the Nios II. I can compile, link, and add to the filesystem the following code:
# include <stdio.h> // hello_nios.cpp int main(int argc, char * argv[]) { printf("Hello, Nios\n"); return 0; } I can execute this succesfully from the command line on the board. However, converting this to standard C++: # include <iostream> int main(int argc, char * argv[]) { std::cout << "Hello, Nios" << std::endl; return 0; } does not work. The program compiles and links, but just sits at the beginning of execution, as though waiting for input. So, to try and resolve this I point my Rules.mak file to the standard C++ library, C:/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/nios2-elf/lib/libstdc++.a. Now, the program doesn't hang, but rather dies with: # hello_nios BINFMT_FLAT: reloc outside program 0xa1b38 (0 - 0x5a314/0x51d10), killing hello_nios! SIGSEGV So now I'm thinking this is the wrong library to link against for C++ -- is anyone out there successfully running C++ apps? If so, how do you link, include, etc? I see no real mention of C++ in the forum, although all the documentation says it's supported. I can include my Rules.mak and Makefiles if needed. Any help would be greatly appreciated. Ryan