Altera_Forum
Honored Contributor
16 years agoProblem building a program with Nios II IDE : undefined reference to 'main'
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);# endifI'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