PDA

View Full Version : [C] Hello Word. Problemi con Eclipse


-hide-
18-12-2008, 19:09
Ciao ragazzi.
Sono passato all'ambiente di sviluppo Eclipse per lavorare sul mac.
Ho scaricato il file "eclipse-cpp-ganymede-SR1-macosx-carbon.tar.gz" dal sito ufficiale e l'ho avviato.

Preparo il mio progettino e metto dentro il Source File di hello_word. Qui di fila il codice, anche se penso sia elementre (ma magari il mac richiede altre implementazioni).

#include <stdio.h>

main ()
{
printf ("Hello Word\n");
}

Compilo e mi da due errori. Questo č ciņ che dice:
**** Build of configuration Debug for project hello word ****

make all
Building file: ../hello_word.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"hello_word.d" -MT"hello_word.d" -o"hello_word.o" "../hello_word.c"
Finished building: ../hello_word.c

Building target: helloword
Invoking: MacOS X C Linker
gcc -o "helloword" ./hello_word.o
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [helloword] Error 1

banryu79
19-12-2008, 12:00
Forse dovresti dichiarare il main() passandogli l'argomento, e magari restituendo un tipo int :)