Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
675 Views

Hello World C++ doesnt work but C works?

Trying to create a simple C++ hello world, but is getting this error when linking. Of course, changing the file name to .c as opposed to .cpp would solve the problem, but how come C++ dont get no love? =p 

 

 

 

#include <stdio.h> int main(void) {    printf("Short size: %d", (unsigned long) sizeof(short));        return 0; } 

 

make -k all  no emulation specific options. nios2-elf-g++  -nostdinc -D__linux__ -O0 -g  -I"c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/include -I/cygdrive/c/altera/kits/nios2_51/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/include -fno-optimize-sibling-calls -mhw-mul -mhw-mulx -Wall -o main.o main.cpp main.cpp: In function `int main()&#39;: main.cpp:5: warning: int format, long unsigned int arg (arg 2) nios2-elf-gcc -msys-crt0="c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/crt0.o -r -d -L"c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib -o main.bin main.o "c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/libm.a /cygdrive/c/altera/kits/nios2_51/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/libgcc.a "c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/libc.a main.o(.text+0x0): In function `_start&#39;: : multiple definition of `_start&#39; c:/altera/kits/nios2_51/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0/lib/crt0.o(.text+0x0): first defined here collect2: ld returned 1 exit status make: *** Error 1 make: Target `all&#39; not remade because of errors. rm main.o
0 Kudos