
edirlf
(usa Ubuntu)
Enviado em 06/09/2007 - 15:29h
Tenho estes arquivos em um mesmo diretório
------------------------
//main.c
#include "prototipos.h"
int main (void){
escreve();
}
------------------------
//funcoes.c
#include "prototipos.h"
void escreve (void){
printf ("Ola mundo!\n");
}
------------------------
//prototipos.h
#include <stdio.h>
#include <stdlib.h>
void escreve (void);
------------------------
O problema é que não consigo compilar eles, sempre me retorna este erro:
$ gcc -o funcoes funcoes.c
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
Um erro parecido acontece quando tento compilar o arquivo main.c.
$ gcc -o main main.c
/tmp/ccwsuZ9a.o: In function `main':
main.c:(.text+0x12): undefined reference to `escreve'
collect2: ld returned 1 exit status
Se alguém puder me ajudar eu agradeço muito, mesmo.
Um abraço.
Edir.