- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone.
I'm a newbie at using Nios II IDE, and I'd like to run a C++ program I did on Cyclone II Development Board. For that, I created a "nios ii application with bsp template" with a .sopcinfo file that a coworker gave me. I created a "Hello_world" project and I renamed "hello_world.c" into "hello_world.cc" because I want to program in C++. I'll now talk about the following program :#include <iostream># include "system.h"
int main()
{
return 0;
}
My problem is that I can't build that simple program, because I get the following error : --- Quote Start --- ../Test_bsp/libhal_bsp.a(alt_main.o)(.text+0x58): In function `alt_main': d:/Algo_Nios/software/Test_bsp/HAL/src/alt_main.c:165: undefined reference to `main' --- Quote End --- which refers to the following lines in "alt_main.c" : #ifdef ALT_NO_EXIT
main (alt_argc, alt_argv, alt_envp);# else
result = main (alt_argc, alt_argv, alt_envp); <-- that's the line
close(STDOUT_FILENO);
exit (result);# endif
I've tried various things, like including the "alt_main.h" librairy, or type "int alt_main()" instead of "int main()", but no matter what I do, I can't build the project. I'd appreciate any help or hints to solve my problem. Thanks, Tthegarde
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
File name extension does matter. For instance, if you change the filename to "hello_world.cpp", it works.
Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would report this to Altera.
Table 4-3 on page 4-5 of the "NIOS II Software Developer's Handbook": http://www.altera.com/literature/hb/nios2/n2sw_nii5v2.pdf indicates that the ".cc" extension is supported. However, the Altera plugin for eclipse is not adding files with this extension to the Makefile automatically. Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your quick answer Jakobjones. I did renamed my file into "xxx.cpp" and it builds correctly.
I did thought that the ".cc" extension was supported because I saw it in the Project --> "Properties / C/C++ General / File Types" and it was associated with "C++ Source Files" ... I'll check if that issue is not already known, and eventually report it to Altera. Tthegarde- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I just had the same error whereas I work in C and not in C++ (enable_c_plus_plus option unchecked). The solution I found is to delete the /libhal_bsp.a file from the BSP and generate then clean -> build the project again and now it works. I've tried to regenerate the error without success. Maybe it can help some of you. Regards- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did same way what you have mention here. I am still getting this errors undefined reference to fread, fopen, fseek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Figured our another way around this. When I was creating the project from BSP file in Nios II Eclipse, the project directory already existed (and contained 2 source files inside). Apparently if the wizard isn't the one creating the folder, it will give you that error. So I renamed the folder to 'sources', created the project 'pname' in folder 'pname' that was not there and it worked.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page